SQL Server Error 8152 — String or binary data would be truncated
String or binary data would be truncated in table 'X', column 'Y'. Truncated value: '...'.
You tried to insert or update a value longer than the column's defined length (e.g. writing 60 characters into a varchar(50)). Modern SQL Server versions (2019+, under the newer compatibility level) name the exact table, column, and value — older versions just give the generic 8152 with no specifics.
Common causes
- Column sized too small for real-world data (common with varchar(50) name/email fields)
- A source system or import feed sending longer values than originally scoped
- String concatenation in a query producing a longer result than the destination column allows
- Unicode data (nvarchar) mismatched with a varchar column, effectively doubling perceived length
How to fix it
- If on SQL Server 2019+, check the database compatibility level (ALTER DATABASE ... SET COMPATIBILITY_LEVEL = 150 or higher) to get the detailed version of this error with the actual column and value named.
- Identify the offending column: SELECT name, max_length FROM sys.columns WHERE object_id = OBJECT_ID('table').
- Decide: widen the column (ALTER TABLE ... ALTER COLUMN ... varchar(100)) if the longer data is legitimate, or fix upstream validation if it's bad data.
- Add application-layer length validation so this fails fast and clearly, not deep in a batch job.
Paste your error and table definition here for a fix specific to your schema.
Try error explainer free →