General discussion


Help with Triggers

By rich ·
I'm trying to duplicate a table in my SQL Server database using triggers. I figured out how to insert and update but I can't figure out the T-SQL for deleting a recordset in the duplicate table when it's deleted in the original table.



This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Post an example

by dds In reply to Help with Triggers

There should be an example of this in your docs.

Here is an example. Hope this helps you:

create trigger cascade_dtrig
on titles
for delete as
/* Cascade deletes to dependants in the dependant table */
delete roysched from roysched, deleted where
roysched.title_id = deleted.title_id

Related Discussions

Related Forums