String or binary data would be truncated
Msg 8152, Level 16, State 13, Line 2
String or binary data would be truncated.
The statement has been terminated.
A lovely error in a 300 lines of SQL update statement in SQL Server 2005, it does not say what field was truncated, what line was truncated.

This feature is shipped in SQL Server 2017 CU12, SQL Server 2019 CTP and upcoming SQL Server 2016 CP2 CU. Read more at https://blogs.msdn.microsoft.com/sql_server_team/string-or-binary-data-would-be-truncated-replacing-the-infamous-error-8152/
9 comments
-
happydba commented
The trace flag doesn't work with table variables in SQL Server 2017 CU16
-
Anonymous commented
1234567
-
mfreeman@bdo.com commented
Based on the new error messages in SQL 2019, it appears that this is in process, but some official word here would be helpful.
-
Bob Sovers commented
This appears to be a duplicate of "binary or string data would be truncated => error message enhancments"
-
Bob Sovers commented
This appears to be a duplicate of "binary or string data would be truncated => error message enhancments"
-
Hundredth Vector commented
Dear Guy,
Per the linked item, as of August 2016, David [MSFT] @ SQLServer appears to be working on this issue. Because of the advanced age and impact of this issue, it would be helpful if a timeframe were set for resolution. Many loyal developers would be grateful for whatever assistance you can lend to communicating the importance of this issue.
Regards,
Mark
-
DWalker07 commented
I opened the Connect item 339410, which is linked here, nearly 10 years ago... and there was a previous item before that. It's about time this gets fixed!
If it's fixed in Azure, then Azure will be better than "regular" Microsoft SQL Server....
-
Bernard Vander Beken commented
To improve SQL Server usability, the Database should include the column name that caused the error.
Example and workaround:
http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/how-to-find-what-column/ -
When you try to insert data into a column that is larger than the column, the error message is poor:
String or binary data would be truncated.
The statement has been terminated.Example:
create table holdSmaller
(
value varchar(2),
value1 varchar(2),
value2 varchar(2)
)
go
insert into holdSmaller
values ('12','1','123')Msg 8152, Level 16, State 14, Line 1
String or binary data would be truncated.
The statement has been terminated.