Creating a non-clustered index on columns of type varchar(max)
is not allowed in SQL Server.
So, what is the maximum varchar
length that a non-clustered index be created on?
Creating a non-clustered index on columns of type varchar(max)
is not allowed in SQL Server.
So, what is the maximum varchar
length that a non-clustered index be created on?
2条答案
按热度按时间fquxozlt1#
Key column length should not exceed 900 bytes, but with SQL Server 2016 cu2, this has increased to 1700 bytes.
You can include max columns as included,though they should be not part of key columns..
Just to add, from SQL Server 2012, you can also rebuild index columns which are of LOB type, though
text
,ntext
andimage
are not supported..Remus Rusanu has a good blog on why online index rebuild operations were not supported in earlier versions of 2012.
Further reading:
xzv2uavs2#
The maximum number of bytes for a non-clustered Index (pre 2016) is 900:
https://learn.microsoft.com/en-us/sql/sql-server/maximum-capacity-specifications-for-sql-server
So, give VARCHAR(900) a go and let us know how you get on.