当我使用 SSMS GUI 在 varchar(1024) 列上创建索引时,它失败并显示以下消息:
"Warning! The maximum key length is 900 bytes. The index 'XXX' has maximum length of 1024 bytes. For some combination of large values, the insert/update operation will fail."
Run Code Online (Sandbox Code Playgroud)
但是,当我使用 SQL(不是 GUI)时,同样的操作成功了。我不确定为什么会发生这种情况,但这是否意味着索引会一直工作,直到超过 900 字节的数据真正插入到列中?
(该列当前没有超过 900 字节的值。)
环境: - SQL Sever 2012 - Windows Server 2008 R2 SP1