Jim Horn
asked on
DROP every constraint
Hi guys
Question: When you drop a table, how do you ensure that you drop every constraint on the table first?
<pseudo code>
IF OBJECT_ID('log.EXECUTIONS' ,'U') IS NOT NULL
begin
ALTER TABLE log.EXECUTIONS DROP CONSTRAINT <every friggin' constraint on the table> -- <-- Here
DROP TABLE log.EXECUTIONS
end
GO
Thanks in advance.
Jim
Question: When you drop a table, how do you ensure that you drop every constraint on the table first?
<pseudo code>
IF OBJECT_ID('log.EXECUTIONS'
begin
ALTER TABLE log.EXECUTIONS DROP CONSTRAINT <every friggin' constraint on the table> -- <-- Here
DROP TABLE log.EXECUTIONS
end
GO
Thanks in advance.
Jim
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Haven't had a chance to circle back to this, sorry, but reordering the DROPs based on child-parent order seems to have worked. Thanks.
ASKER
I'm going to wait a couple of days to make sure that is correct.
Thanks.
Jim