Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我刚试过这个,得到了有用的信息
表 'Users' 中的列 'Username' 的类型不能用作索引中的键列。
用户名是一个 nvarchar(max) 列。
您不能将索引添加到 nvarchar(max) 或 varchar(max) 列,但它可以是索引的一部分。
您可以将其包含在索引中,但该索引需要离线创建/重建。
从您的列名“用户名”中猜测,我会将列类型更改为较小的类型,例如 nvarchar(50)。nvarchar(max) 数据类型最多可以存储 4Gb 的文本,并用于更多的全文存储(在这种情况下,您将设置全文搜索)。