SQL SERVER – Maximum Columns per Primary Key – Fix : Error : Msg 1904, Level 16, The index on table has column names in index key list. The maximum limit for index or statistics key column list is 16

My present article covers two fundamental questions.

1) What is the maximum number of columns included in Primary Key Index/Constraint?
2) What is fix/solution for the following error:

Msg 1904, Level 16, State 1, Line 1
The index ” on table ‘dbo.Table_2’ has 17 column names in index key list. The maximum limit for index or statistics key column list is 16.

The same error surfaces when example is created using SSMS.
SQL SERVER - Maximum Columns per Primary Key - Fix : Error : Msg 1904, Level 16, The index on table has column names in index key list. The maximum limit for index or statistics key column list is 16 pk161

Fix/Solution/Workaround:
Maximum columns per Primary Key Index is 16. In fact, 16 is the limit for columns per Foreign Key and Index Key.
You cannot have more than 16 columns per Index Key, Primary Key or Foreign Key. So, reduce the columns in those column to less than or equal to 16 columns.

SQL SERVER - Maximum Columns per Primary Key - Fix : Error : Msg 1904, Level 16, The index on table has column names in index key list. The maximum limit for index or statistics key column list is 16 pk16

Reference : Pinal Dave (https://darkslategrey-bat-805937.hostingersite.com)

SQL Error Messages, SQL Index, SQL Scripts
Previous Post
SQLAuthority News – SQL Server 2008 Service Pack 1 Released – Available for Download
Next Post
SQL SERVER – Fix Error 9803. Invalid data for type “numeric” – Data Type Mapping

Related Posts

Leave a Reply