A New Way to Deal with “String/Binary Data Truncated”

Anyone who has used SQL Server to insert data into a table has certainly come across the infamous error “String or binary data would be truncated” when data is too large to fit into the target data type.

Let the hunt begin

We all know if you are faced with this error, you can be sure to spend some precious time troubleshooting it. Fortunately, Microsoft has some goodies in store for us in SQL Server 2019 to make our lives easier spotting this error.

How to make life easy again? 

When we are faced with the above-mentioned error, we can enable the new trace flag = 460 to receive a new error which provides more context about the problem. The trace flag 460 can be used in the scope of a Global, Session & Query.

I will try to insert the below record into my table:

Resulting in the error:

Now I will activate the new trace flag:

Now as you can see we receive a brand new message giving me exact context for troubleshooting the error.

Life made easy again

You can use this trace flag in the below three ways:

3 Responses

  1. I’ll immediately take hold of your rss feed as I can’t in finding
    your email subscription link or e-newsletter service. Do you have any?

    Kindly permit me recognize in order that I may just subscribe.


  2. Tomasz Gacek says:

    Thx, very useful tip!

Leave a Reply

Your email address will not be published. Required fields are marked *