I am now running the following line
-- Create Table
CREATE TABLE MyTable (MyId INT IDENTITY (1,1),
MyCity NVARCHAR(50),
CONSTRAINT PK_MyId PRIMARY KEY CLUSTERED (MyId))
-- Populate Dummy data
INSERT INTO MyTable VALUES ('Boston')
INSERT INTO MyTable VALUES ('New Delhi')
-- Disable Clustered Index
ALTER INDEX PK_MyId ON MyTable DISABLE
-- Drop the associated constraints
ALTER TABLE MyTable DROP CONSTRAINT PK_MyIdGO
GO
-- Check
SELECT * FROM MyTable
-- Cleanup!
DROP TABLE MyTable
I am getting the following output
(1 row(s) affected)
(1 row(s) affected)
Msg 3728, Level 16, State 1, Line 11
'PK_MyIdGO' is not a constraint.
Msg 3727, Level 16, State 0, Line 11
Could not drop constraint. See previous errors.
Msg 8655, Level 16, State 1, Line 2
The query processor is unable to produce a plan because the index 'PK_MyId' on table or view 'MyTable' is disabled.
Is I am still missing something??