我正在 SQL Azure 上运行此命令。
DELETE FROM dbo.Users
我收到此错误。
Msg 40054, Level 16, State 1, Line 1
Tables without a clustered index are not supported in this version of SQL Server. Please create a clustered index and try again.
然后我尝试创建聚集索引。
CREATE UNIQUE CLUSTERED INDEX Idx_Users ON dbo.Users(Id);
我收到此错误。
Msg 1902, Level 16, State 3, Line 4
Cannot create more than one clustered index on table 'dbo.Users'. Drop the existing clustered index 'PK_dbo.Users' before creating another.
我有没有聚集索引?
最佳答案
我遇到了类似的问题,无法从表中删除记录。
读完这篇文章后,SQL Azure not recognizing my clustered Index ,与您的帖子配对,我通过 MSSMS 检查了我的 Security_User
表上的依赖关系; 0-n 关系表 Security_UserHistory
具有对此表的 FK 引用。该引用未编入索引,并且(奇怪的是)触发了相关错误。
将聚集索引应用于引用 PK 表 Security_User
的 FK 表 Security_UserHistory
后,问题得到解决。
我希望 Microsoft 能够在错误消息中添加一些说明,因为它表明问题出在您要从中删除行的表上。
关于sql - Azure 中具有聚集索引的表出现聚集索引错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29874250/