Paste this into a new question or an answer at dba.stackexchange.com:
<!-- --> > CREATE TABLE VarcharClustered > ( > ID INT > ,Name VARCHAR(2000) > ) > GO > > <pre> > ✓ > </pre> <!-- --> > CREATE CLUSTERED INDEX idx_VarcharClustered_Name ON VarcharClustered(Name) > GO > > <pre> Warning! The maximum key length for a clustered index is 900 bytes. The index 'idx_VarcharClustered_Name' has maximum length of 2000 bytes. For some combination of large values, the insert/update operation will fail. > </pre> <!-- --> > INSERT INTO VarcharClustered > VALUES (1,REPLICATE('a',1701)) > GO > > <pre> > Msg 1946 Level 16 State 3 Line 1 Operation failed. The index entry of length 1701 bytes for the index 'idx_VarcharClustered_Name' exceeds the maximum length of 900 bytes for clustered indexes. > </pre> <!-- --> > INSERT INTO VarcharClustered > VALUES (1,REPLICATE('a',1700)) > GO > > <pre> > Msg 1946 Level 16 State 3 Line 1 Operation failed. The index entry of length 1700 bytes for the index 'idx_VarcharClustered_Name' exceeds the maximum length of 900 bytes for clustered indexes. > </pre> <!-- --> > INSERT INTO VarcharClustered > VALUES (1,REPLICATE('a',901)) > GO > > <pre> > Msg 1946 Level 16 State 3 Line 1 Operation failed. The index entry of length 901 bytes for the index 'idx_VarcharClustered_Name' exceeds the maximum length of 900 bytes for clustered indexes. > </pre> <!-- --> > INSERT INTO VarcharClustered > VALUES (1,REPLICATE('a',900)) > GO > > <pre> 1 rows affected > </pre> *db<>fiddle [here](https://dbfiddle.uk/?rdbms=sqlserver_2016&fiddle=137aa186f9ce9817bf1b12fd2f892714)*
back to fiddle