SQL Server Specification Limits – Maximum bytes allowed for the Keys in SQL Server

By Santhosh N

This explains the maximum size in bytes that is allowed for keys (Primary, index and foreign keys) in SQL Server.

SQL Server imposes a maximum allowed size for creation of keys and here is the size limits for various keys:


Index Key 900 Bytes
Primary Key 900 Bytes
Foreign Key 900 Bytes


However, there is small exception to the maximum size for Index Key. An Index key can be created using variable length columns whose maximum size(s) can be more than 900, but no row should be inserted with more than 900 bytes in those columns.


Note: This hold common for both 32-bit and 64-bit SQL Server.

Related FAQs

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 to set DEADLOCK_PRIORITY in SQL Server and its benefits in doing so.
This explains how to use TEMP tables in the SELECT query for better query performance.
This explains how (in which order) the SQL Server stores the records in the table.
SQL Server Specification Limits – Maximum bytes allowed for the Keys in SQL Server  (872 Views)