Varchar(max) column not allowed to be a Primary Key in SQL Server

前端 未结 3 1631
我在风中等你
我在风中等你 2021-01-17 18:16

Varchar(max) column not allowed to be a Primary Key in SQL Server.

What is the max length of a varchar type that can be made a primary key.

This might be a b

3条回答
  •  终归单人心
    2021-01-17 18:38

    The primary key is used in all other indexes to identify rows. Having a potentially multi-megabyte value as a key makes very little sense, hence the limit in general on total bytes in any key.

提交回复
热议问题