Hi, I need to delete records in a table with 15 dependencies.
I can't drop the 15 dependencies before delete records.
Any ideas to delete records without dropping dependencies
Thanks,Do you mean you want to delete a PK record which is used as a FK in 15
tables?
You could change the cascade option on the FKs to be a setting other than
the default - from BOL: ON DELETE { NO ACTION | CASCADE | SET NULL | SE
T
DEFAULT }
Alternatively you could temporarily disable the FK constraint (ALTER TABLE
cnst_mytable NOCHECK CONSTRAINT myfk), although I'd doubt the wisdom of this
approach.
Thinking a little wider, I'd like to know more about the design you have
which will need to allow for orphaned records, if I have understood this
correctly.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .|||Thanks a lot.
Your concern is correct 100%.
We are doing the test only for the same concern
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:%23eBTMeZCHHA.4224@.TK2MSFTNGP06.phx.gbl...
> Do you mean you want to delete a PK record which is used as a FK in 15
> tables?
> You could change the cascade option on the FKs to be a setting other than
> the default - from BOL: ON DELETE { NO ACTION | CASCADE | SET NULL |
SET
> DEFAULT }
> Alternatively you could temporarily disable the FK constraint (ALTER TABLE
> cnst_mytable NOCHECK CONSTRAINT myfk), although I'd doubt the wisdom of
> this approach.
> Thinking a little wider, I'd like to know more about the design you have
> which will need to allow for orphaned records, if I have understood this
> correctly.
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com .
>
No comments:
Post a Comment