Clustered index error in Azure for a clustered index table
I am running this command on SQL Azure.
DELETE FROM dbo.Users
I am getting this error.
Msg 40054 Level 16 State 1 Line 1
Tables without a clustered index are not supported in this version of SQL Server. Create a clustered index and try again.
Then I try to create a clustered index.
CREATE UNIQUE CLUSTERED INDEX Idx_Users ON dbo.Users(Id);
I am getting this error.
Msg 1902, Level 16, State 3, Line 4
Cannot create more than one clustered index on table "dbo.Users". Pack the existing clustered index "PK_dbo.Users" before creating another cluster.
Do I or I don't have a clustered index?
source to share
I had a similar problem where I was unable to delete records from a table.
After reading this post, SQL Azure does not recognize my clustered pointer , paired with your post, I checked the dependencies via MSSMS on my table Security_User
; the relationship table 0-n Security_UserHistory
,, had an FK reference to this table. This link was not indexed and (oddly enough) threw an error.
After applying CLUSTERED INDEX to the FK table Security_UserHistory
referencing the PK table Security_User
, the issue was resolved.
I want Microsoft to add some clarity to the error message as it indicates that the problem is with the table you are deleting rows from.
source to share