SQL Server Specification Limits - Maximum Columns allowed for the Keys in SQL Server
By Santhosh N
This explains the maximum number of columns allowed for keys (Primary, index and foreign keys) in SQL Server.
SQL Server imposes a maximum allowed number of columns for creation of keys and here
are the limitations for various keys:
Index Key 16 Columns
Primary Key 16 Columns
Foreign Key 16 Columns
However, there is small exception to the maximum number of columns allowed
in Index Key. If the participating table contains XML indexes, then the clustering
key of the table can only have 15 columns as XML column is added to the clustering
key of the primary XML index. However, you can include non-key columns in a non-clustered
index to avoid this limitation of 15 or 16 columns and can have more number of
columns.
Note: This hold common for both 32-bit and 64-bit SQL Server.
Related FAQs
This explains the maximum size in bytes that is allowed for keys (Primary, index and foreign keys) in SQL Server.
This explains the maximum size of the STRING Data type Columns’ value allowed by the SQL Server.
This explains the best scenarios to create CLUSTERED index on the table in SQL Server.
This explains about the creation of NON-CLUSTERED indexes and maximum allowed.
This explains how (in which order) the SQL Server stores the records in the table.
This explains how to use TEMP tables in the SELECT query for better query performance.
SQL Server Specification Limits - Maximum Columns allowed for the Keys in SQL Server (1568 Views)