我是SQL新手,正在使用Microsoft SQL Server练习一些练习。我创建了这个索引,然后我试图删除这个索引,但是它说这不是一个约束。但custID栏显示它是主键。尝试删除索引时出错
这是我做过什么:
CREATE INDEX indexcustInfoID ON tblCustomerIDInfo (CustID)
ALTER TABLE tblCustomerIDInfo
DROP CONSTRAINT indexcustInfoID
错误:
Msg 3728, Level 16, State 1, Line 26
'indexcustInfoID' is not a constraint.Msg 3727, Level 16, State 0, Line 26
Could not drop constraint. See previous errors.
请帮帮我!
你并不需要在主键添加一个索引 - 一个将被自动创建。 –
哦,我知道了。我正在关注一个他们使用MySQL的视频,这个人也是这么做的,但我使用的是sql server。创建和删除索引时,两者是否有区别? – Gracie