EditingEven though this works, let me try to add a new table:
CREATE TABLE MyTable2
(
Id int,
MyTable_Id int NOT NULL,
CONSTRAINT [PK_MyTable2] PRIMARY KEY (Id),
CONSTRAINT [FK_MyTable2] FOREIGN KEY (Id) REFERENCES MyTable(Id)
);
Yes, there is a FOREIGN KEY that references Id field of MyTable. Now try to execute the script again and...
Msg 3725 Level 16 State 0 Line 25
The constraint 'PK_MyTable' is being referenced by table 'MyTable2', foreign key constraint 'FK_MyTable2'.
Msg 3727 Level 16 State 0 Line 25
Could not drop constraint. See previous errors.
dbfiddle here
Yes, bad news again, to drop a PRIMARY KEY, you should DROP all FOREIGN KEYS that references this field before.