CREATE DATABASE TestDB GO USE TestDB GO CREATE TABLE TestTable ( [ID] INT IDENTITY(1,1), [NAME] VARCHAR(10), ) GO
INSERT INTO TestTable VALUES ('Some dummy data') GO INSERT INTO TestTable VALUES ('Some more dummy data') GO
returns errors:
SQL TRUNCATE error message ‘String OR BINARY DATA would be truncated.’
SELECT len('Some dummy data') AS [StringLength] SELECT len('Some more dummy data') AS [StringLength]
NOTE: This should return 15 and 20.
SELECT character_maximum_length,column_name FROM information_schema.columns WHERE TABLE_NAME = 'TestTable' AND Column_name='NAME'
returns:
10
SET ANSI_WARNINGS off GO INSERT INTO TestTable VALUES ('Some dummy data') GO INSERT INTO TestTable VALUES ('Some more dummy data') GO SET ANSI_WARNINGS ON GO