DBAtlas · Database operations atlas

8152: String or binary data would be truncated

SQL Server

What does it mean?

You tried to write data longer than a column's defined length. SQL Server stops the statement to prevent data loss (2628 is the newer version of the same error that reports the column/value).

Why does it happen?

For example writing 15 characters into a VARCHAR(10) column, a target column narrower than the source, a data type/length mismatch, or insufficient field size in ETL/transfers.

How to fix it

Widen the column to fit the data (ALTER TABLE ... ALTER COLUMN) or shorten the data. On SQL Server 2019+, use error 2628, which shows the table/column/value that overflowed; on older versions, check columns one by one with LEN() to find the offending row. In transfers, align source and target schema lengths.

Open in DBAtlas →

More from this engine