Do you get frustrated when you insert or update data and you get the message:
truncation occurred.
Microsoft finally heard us and is changing the message to give us more information. If you are on SQL Server 2019 and have your compatibility level set to 150 then you already get the new error message. If you aren't so lucky, but are using SQL Server 2017 CU12 or higher then you can enable traceflag 460 to get a detailed truncation message.
https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql?view=sql-server-ver15
You can enable this traceflag by running
DBCC TRACEON(460)
This changes the truncation message for your current session to the form:
String or binary data would be truncated in table '<Table>', column '<column>'. Truncated value: '<value>'.
To disable you simply run
DBCC TRACEOFF(460)
You can verify it is off by running
DBCC TRACESTATUS
No comments:
Post a Comment