Unable to drop and create a foreign key constraint
Posted on 2007-11-14
I dropped the foreign key from my database table using..
alter table MyTable drop constraint mytable_fkey
Then I attempted to create it again using this command..
alter table MyTable add constraint mytable_fkey foreign key ( fkeyColum ) references otherTable
I get the error...
Msg 547, Level 16, State 0, Line 1
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "mytable_fkey". The conflict occurred in database "mydatabase", table "dbo.otherTable", column 'otherTable_id'.
So, I figure I didn't really drop it.. so I run the drop command again and get this...
Msg 3728, Level 16, State 1, Line 1
'mytable_fkey' is not a constraint.
How can It not be a constraint (so i can't drop it) and already exist so I can't create it?
Is the error on create referring to something else that I need to remove like an index?