Search code examples
sqlsql-server-2017

Turning on Trace Flag 460 does not give a better error message


I have a large insert query with ends in an error:

Msg 8152, Level 16, State 4, Line 1
String or binary data would be truncated

After some research I tried using TRACE FLAG 460, using the command below:

INSERT... 
VALUES...
OPTION (QUERYTRACEON 460);

This gave the same error as before, so I tried to turn on the flag on server-level, using the command below:

DBCC TRACEON(460, -1);

Again, no change in the output. But when I check the flagstatus it gives all the right information:

DBCC TRACESTATUS(460);

TraceFlag   Status  Global  Session
460         1       1       0

Does anyone have a clue how I can get Trace Flag 460 working? My server information is down below:

Edition: Developer Edition (64-bit)
ProductVersion: 14.0.2037.2
ResourceLastUpdateDateTime: 2020-11-02 21:20:26.783
ResourceVersion: 14.00.2037
BuildClrVersion: v4.0.30319

Solution

  • Have you checked the documentation??

    It clearly says:

    Note: This trace flag applies to SQL Server 2017 (14.x) CU12 and higher builds

    Which means SQL Server 2017 has to have a build version number of 14.0.3045.24 or higher - which you don't seem to have.

    So you'll need to install at least CU12 (or better yet: the latest CU22 - https://www.microsoft.com/en-us/download/details.aspx?id=56128) on your machine for this to work

    See: SQL Server 2017 build versions - for all the details about the official version numbers of SQL Server 2017 (and it's various CU's)