By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3609956 fiddles created (46890 in the last week).
CREATE TABLE VarcharClustered
(
ID INT
,Name VARCHAR(2000)
)
✓
hidden batch(es)
CREATE CLUSTERED INDEX idx_VarcharClustered_Name ON VarcharClustered(Name)
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.
hidden batch(es)
INSERT INTO VarcharClustered
VALUES (1,REPLICATE('a',1701))
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.
hidden batch(es)
INSERT INTO VarcharClustered
VALUES (1,REPLICATE('a',1700))
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.
hidden batch(es)
INSERT INTO VarcharClustered
VALUES (1,REPLICATE('a',901))
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.
hidden batch(es)
INSERT INTO VarcharClustered
VALUES (1,REPLICATE('a',900))