2628: String or binary data would be truncated in table, column ...; truncated value
SQL ServerWhat does it mean?
The enhanced version of 8152 (SQL Server 2019 and later). It explicitly reports which table, which column and which value would be truncated.
Why does it happen?
Writing a text/binary value longer than the target column's defined length. Usually a schema mismatch or input data of unexpected length.
How to fix it
Look at the table and column name in the error text; either widen the column or shorten the source value. In SQL Server 2019, 2628 is raised by default only at compatibility level 150+; at lower levels enable it with ALTER DATABASE SCOPED CONFIGURATION SET VERBOSE_TRUNCATION_WARNINGS = ON or trace flag 460. From SQL Server 2016 SP2 CU6 and 2017 CU12 onward, trace flag 460 gives the same detailed message. Align field lengths with the target in the transfer layer.
More from this engine
- 547The INSERT/UPDATE/DELETE statement conflicted with the FOREIGN KEY / CHECK constraint
- 18456Login failed for user
- 8152String or binary data would be truncated
- 1222Lock request time out period exceeded
- 9002The transaction log for database is full due to ...
- 1105Could not allocate space for object in database because the filegroup is full
- 208Invalid object name