The %S_MSG ‘%.*ls’ on table ‘%.*ls’ has %d column names in %S_MSG key list. The maximum limit for index or statistics key column list is %d.

Error Message:
Msg 1904, Level 16, State 1, Line 1
The %S_MSG ‘%.*ls’ on table ‘%.*ls’ has %d column names in %S_MSG key list. The maximum limit for index or statistics key column list is %d.

Severity level:
16.

Description:
This error message appears when you try to create an index or a constraint with more than 16 columns.

Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.

Resolution:
Error of the Severity Level 16 are generated by the user and can be fixed by the SQL Server user. The statement cannot be executed this way. The maximum number of column in an index or a constraint in SQL Server is 16.

Versions:
All versions of SQL Server

Example(s):
USE tempdb;
GO
IF OBJECT_ID(‘tempdb..#t’) > 0
 DROP TABLE #t
GO
CREATE TABLE #t
(c1 INT,
 c2 INT,
 c3 INT,
 c4 INT,
 c5 INT,
 c6 INT,
 c7 INT,
 c8 INT,
 c9 INT,
 c10 INT,
 c11 INT,
 c12 INT,
 c13 INT,
 c14 INT,
 c15 INT,
 c16 INT,
 c17 INT
)
GO
ALTER TABLE #t
  ADD CONSTRAINT PK_t PRIMARY KEY
  (
 c1,
 c2,
 c3,
 c4,
 c5,
 c6,
 c7,
 c8,
 c9,
 c10,
 c11,
 c12,
 c13,
 c14,
 c15,
 c16,
 c17);

Remarks:
In the above example we try to create a PRIMARY KEY constraint with more than 16 columns. This raises the error.




Array

No comments yet... Be the first to leave a reply!