Improvement: Optional replacement for "String or binary data would be truncated" message with extended information in SQL Server 2017

Applies to: SQL Server 2017 DeveloperSQL Server 2017 EnterpriseSQL Server 2017 Enterprise Core More

Symptoms


When you try to store string or binary data that exceeds the target column size in Microsoft SQL Server, you receive the following error message:

Msg 8152, Level 16, State 6, Procedure ProcedureName, Line Linenumber
String or binary data would be truncated.


This SQL Server 2017 update introduces an optional message that contains the following additional context information.

Msg 2628, Level 16, State 6, Procedure ProcedureName, Line Linenumber
String or binary data would be truncated in table '%.*ls', column '%.*ls'.
Truncated value: '%.*ls'.


The new message ID is 2628. This message replaces message 8152 in any error output if trace flag 460 is enabled.

Resolution


This improvement is included in the following cumulative update for SQL Server:

      Cumulative Update 12 for SQL Server 2017

References


Learn about the terminology Microsoft uses to describe software updates.