General discussion

Locked

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.

TIA,

Rich

This conversation is currently closed to new comments.

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

Back to Software Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums