[SQLSTATE 22001] (Error 8152) when creating replication

Peter Viau 0 Reputation points
2023-03-06T17:58:27.6366667+00:00

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

https://learn.microsoft.com/en-us/sql/relational-databases/replication/tutorial-preparing-the-server-for-replication?source=recommendations&view=sql-server-ver16

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,675 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 100.9K Reputation points MVP
    2023-03-06T22:23:41.8466667+00:00

    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
    2023-03-07T05:57:58.43+00:00

    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,

    Seeya


    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