Microsoft SQL Server Error: SQL SERVER – Msg 8152, Level 16, State 14 – String or Binary Data Would be Truncated

Microsoft SQL Server Error: SQL SERVER – Msg 8152, Level 16, State 14 – String or Binary Data Would be Truncated

Details of Error:

String or binary data would be truncated. The statement has been terminated.

This error message below occurs when part data is been truncated while loading a table.

Actual error message:

Msg 8152, Level 16, State 14, Line 8
String or binary data would be truncated.
The statement has been terminated.

Resolution:

Either Shortened the data which is being truncated or increase length of the column on the Table or use below statements at the top and bottom of sql insert statement which is suppress the error

SET ANSI_WARNINGS OFF;
-- Insert TSQL here.
SET ANSI_WARNINGS ON;

By using Andi_Warnings off, the error will be suppressed in the above code, but we lost part of the actual data which we were supposed to have on the table. So be cautious when working with such SET options.

Additional information below:

Use ANSI_WARNING OFF with care as sometimes important data can be truncated or lost. Also has negative impact on performance of insert statement.

Vamshi B

Recent Posts

sql server detected logical consistency based error

Learn about SQL Server detecting logical consistency based issues and how to resolve them.

5 months ago

sql server error 1222

Learn about SQL Server error 1222 and how to resolve the lock request time out…

5 months ago

Microsoft SQL Server 2022 New Features

Discover the new features of Microsoft SQL Server 2022 and how they compare to previous…

5 months ago

SQL Server Error 1222 lock request time out period exceeded

SQL Server Error 1222 lock request time out period exceeded   Lock request time out…

5 months ago

SQL Server Error : 427, Severity: 20. Could not load the definition for constr

SQL Server Error : 427, Severity: 20. Could not load the definition for constraint ID…

10 months ago

SQL Server Error : 204, Severity: 20. Normalization error in node %ls.

SQL Server Error : 204, Severity: 20. Normalization error in node %ls.

10 months ago

This website uses cookies.