SYNCH ERROR: [8152] String or binary data would be truncated

I received this message upon starting a synch between two databases, that included insert new rows. What would have caused this error, and does RedGate identify the exact row that was the culprit? It is difficult to tell from the error message.
:?

Comments

  • I might get corrected on this one, but if I remember correctly, this warning is just generated when you perform a sync between two columns, and the destination has a smaller maximum width than the source - such as an nvarchar(10) going to an nvarchar(5).

    I don't believe we check explicitly that data will be truncated (since that could be a very expensive operation if the table has a large number of rows), just that there's the possibility of it happening.

    Hope that helps,
    Robert
    Robert Chipperfield
    Red Gate
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    The reason why this happens is that SQL Server is adhering to the ANSI behavior and not allowing data to be trucnated. Typically this happens in SQL Compare rather than data compare, but here is the workaround:

    Save the synchronization script to a file.
    Add the line SET ANSI_WARNINGS OFF on the line immediately below SET NUMERIC_ROUNDABORT.

    This allows you to truncate columns in SQL Server tables (at your own peril, of course!)
Sign In or Register to comment.