July 16, 2002 at 9:37 pm
as an example if i want to drop the Publishers table in Pubs database it won't let me because of a Foreign Key constraint.
I then run
sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT ALL"
attempting to disable all constraints so that I can go ahead and drop the table but it still won't let me.
How can I programmatically disable these foreign key constraints to allow me to drop this table?
Brian Lockwood
President
LockwoodTech Software
Brian Lockwood
President
ApexSQL - SQL Developer Essentials
July 17, 2002 at 5:20 am
Cant disable, have to remove the foreign key relationship.
Andy
July 17, 2002 at 6:19 am
Actually you can disable it for INSERT and UPDATE which is all. To be able to drop a table, even if disabled you have to drop the FK constraint first, then drop the table. If not then you would retain garbage in your database which would degrade it.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
July 17, 2002 at 8:55 am
quote:
Actually you can disable it for INSERT and UPDATE which is all. To be able to drop a table, even if disabled you have to drop the FK constraint first, then drop the table. If not then you would retain garbage in your database which would degrade it."Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
OK - thanks for the quick answers guys.
Brian Lockwood
President
LockwoodTech Software
Brian Lockwood
President
ApexSQL - SQL Developer Essentials
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply