[SQLSTATE 22001] (Error 8152) when creating replication

Peter Viau 0 Reputation points

I get error [SQLSTATE 22001] (Error 8152) when creating publisher even when following these instructions on sql 2019


SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,573 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 100.7K Reputation points MVP

    8152 - the dreaded message String or binary data would be truncated.

    Exactly at which point does it happen?

    Review what names you have in your environment? Maybe there something which unusually long?

    0 comments No comments

  2. Seeya Xi-MSFT 16,436 Reputation points

    Hi @Peter Viau ,

    The error message you're receiving indicates that the value you're trying to insert or update is too long for the column it's being inserted into. At what step did you get this error? Can you give more details?

    Do you have insert operations in your database? If so, you can do the following checks.

    This can occur when creating a SQL Server replication publisher if the length of one of the parameters exceeds the maximum length of the column it's being inserted into. Here are a few steps you can take to troubleshoot this issue:

    1. Check the length of the value you're trying to insert or update. Make sure that it doesn't exceed the maximum length of the column it's being inserted into.
    2. Check the data type of the column you're trying to insert into. If it's a numeric column, make sure that you're not trying to insert a string value into it.
    3. If you're using a stored procedure to insert or update data, check the parameter lengths. Make sure that the lengths of the parameters match the lengths of the columns in the table.

    Best regards,


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments