Msg 103, Level 15, State 4, Line 1
The %S_MSG that starts with ‘%.*ls’ is too long. Maximum length is %d.
This error message appears when you try to use an identifier name that exceeds the maximum allowed length.
The T-SQL statement can be parsed, but causes the error at runtime.
Errors of the Severity Level 15 are generated by the user and can be fixed by the SQL Server user. The statement cannot be executed this way. You must choose a short name with up to 128 characters.
All versions of SQL Server.
IF OBJECT_ID(‘t’) IS NOT NULL
DROP TABLE t
DECLARE @sql nvarchar(MAX)
DECLARE @myCol nvarchar(200)
SET @myCol = REPLICATE(‘a’, 200)
SET @sql = ‘CREATE TABLE t(‘ + @myCol + ‘ int)’
EXEC sp_ExecuteSQL @sql
In the above example we try to name a column with an identifier which is 200 characters long. Because this exceeds the maximum allowed length, the error is raised.