Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jrockfl
Posting Yak Master
223 Posts |
Posted - 2004-12-17 : 15:06:52
|
| I need help with my first delete trigger. When a row is deleted in tblAutoShip, then id like the details in tblAutoShipDetails to be deleted.This is what I have so far..CREATE TRIGGER DeleteAutoShipDetails ON tblautoshipFOR DELETEASDELETE FROM tblautoshipdetails, deletedWHERE autoshipid = |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-12-17 : 15:20:32
|
| DELETE aFROM tblautoshipdetails aINNER JOIN deleted dWHERE a.PKColumn1 = d.PKColumn1 AND a.PKColumn2 = d.PKColumn2...Tara |
 |
|
|
jrockfl
Posting Yak Master
223 Posts |
Posted - 2004-12-17 : 15:33:40
|
| Thanks Tara! |
 |
|
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2004-12-17 : 15:42:22
|
| If you have a foreign key constraint between these tables you may want to see if the ON DELETE CASCADE option would save you the overhead of the trigger.HTH=================================================================Happy Holidays! |
 |
|
|
|
|
|