By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,378 Members | 1,385 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,378 IT Pros & Developers. It's quick & easy.

What are my TRIGGER options?

bencoding
P: 22
I am writting a trigger that needs to handle INSERT, UPDATE and DELETE.

Can I use 1 TRIGGER for this? or will I have to writemultiple tiggers? If so how would I make the distinction between if update, do this, if insert do this, and if delete do this?
Mar 21 '08 #1
Share this Question
Share on Google+
3 Replies


ck9663
Expert 2.5K+
P: 2,878
I am writting a trigger that needs to handle INSERT, UPDATE and DELETE.

Can I use 1 TRIGGER for this? or will I have to writemultiple tiggers? If so how would I make the distinction between if update, do this, if insert do this, and if delete do this?
Depending on what you want to do, I believe you can create 1 for all of these. If you want to handle each of these action differently, you're going to have to create 3 triggers.

-- CK
Mar 21 '08 #2

bencoding
P: 22
Depending on what you want to do, I believe you can create 1 for all of these. If you want to handle each of these action differently, you're going to have to create 3 triggers.

-- CK
That's what I am trying to wrap my head around, I have been told I can put them all in one but by someone who may not be sure. This is what I would need to do for each.

for INSERT: insert a record into another table
for UPDATE: update a record into another table after comparing IDs
for DELETE: delete a record from another table
Mar 21 '08 #3

ck9663
Expert 2.5K+
P: 2,878
You're going to need to create a trigger for each of those.

-- CK
Mar 21 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.