SQL server truncated data errors

 

“String or binary data would be truncated”, an error raised by SQL server when trying to update or insert data into a column that is bigger than that column can accommodate.

On my wish list for SQL server for a long time has been that this error should provide the column that raised the error as part of the reported error. Our Microsoft ERP system has very wide tables, approximately two hundred columns in some of them. When this error happens, it becomes a pain to track down the failing column update.

The only way I’ve got to do this at the moment is to add the LEN() function around every possible culprit and check the returned lengths manually against the schema. Whilst this works, it takes a long time, just for lack of the column name in the error raised.

Add comment

Loading