900 byte index size limit in character length

前端 未结 3 1966
灰色年华
灰色年华 2020-12-02 19:55

What is the total character limit for a 900 byte index limit that SQL Server 2012 has. I created a column that has varchar(2000), but I think that it exceeding

3条回答
  •  情话喂你
    2020-12-02 20:40

    For those on SQLServer 2016, Index key size was increased to 1700 bytes..What's new in Database Engine - SQL Server 2016

    The maximum index key size for NONCLUSTERED indexes has been increased to 1700 bytes.

    Demo:

    create table test
    (
    id varchar(800),
    id1 varchar(900)
    )
    
    insert into test
    select replicate('a',800),replicate('b',900)
    
    create index nci on test(id,id1)
    

提交回复
热议问题