June 26, 2006 at 4:31 am
Hai....,
When specifying the relationship for my table, i haven't checked the option to perform cascaded delete operation. But during certain situation i want to make / perform cascaded delete operation while specifying the query. Is this possible or is there any workaround available for this.
June 26, 2006 at 1:01 pm
There is no TSQL command to make the DELETE statement in your query perform a cascaded delete. You would need to write 2 DELETE statements in your query. The first DELETE statement to remove the child rows, the second DELETE should remove the parent rows.
On another note, you could also use an Instead of DELETE trigger on the parent table. Write your logic into the trigger to delete the child rows first.
June 26, 2006 at 3:04 pm
If you wish to cascade some of the time, based on the situation, then it sounds more like a business rule than a data integrity rule. Business logic should be moved out of triggers and into the procedures that perform the deletes in those specific situations, or further up into the business layer, out of the database entirely.
-Eddie
Eddie Wuerch
MCM: SQL
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply