On Transact SQL language the Msg 8152 Level 16 - String or binary data would be truncated means that the length of the insert value is greater than the length of column.
Msg 8152 Level 16 Example:
We have the table TEST:
USE model;
GO
CREATE TABLE TEST(
ID INT NOT NULL PRIMARY KEY,
NAME VARCHAR(10) NOT NULL );
GO
Invalid insert:
USE model;
GO
INSERT INTO TEST(id, name) VALUES (1, 'Olivia Wilson');
GO
Message |
---|
Msg 8152, Level 16, State 14, Line 1 |
String or binary data would be truncated. The statement has been terminated. |
Correct insert:
USE model;
GO
INSERT INTO TEST(id, name) VALUES (1, 'Olivia');
GO
Message |
---|
(1 row(s) affected) |
Other error messages:
- Cannot drop the table
- Is not a constraint
- Create View or Function failed because no column name was specified
- Cannot define PRIMARY KEY constraint on nullable column in table
- Column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
- The database name component of the object qualifier must be the name of the current database
- No item by the name of '%' could be found in the current database.