Discussion Locked

Help with Triggers

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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.

TIA,

Rich

1 reply

by dds

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
begin
/* Cascade deletes to dependants in the dependant table */
delete roysched from roysched, deleted where
roysched.title_id = deleted.title_id
end

This discussion is closed to new replies.