Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 29, 2013 03:00 PM by TabAlleman
Member
7 Points
9 Posts
Jan 29, 2013 02:09 PM|LINK
I have a trigger, which is fired on insert,update and delete.
How would i know in trigger which operation(insert/delete/update) is performed on a table.
All-Star
15727 Points
2721 Posts
Jan 29, 2013 02:22 PM|LINK
You can check SELECT COUNT(*) in inserted and deleted.
Jan 29, 2013 02:25 PM|LINK
Thanks TabAlleman
Is there count in deleted table when delete event is fired?
what for delete event?
and what for update event?
Jan 29, 2013 03:00 PM|LINK
If only the inserted table has rows, then it was an insert.
If only the deleted table has rows, then it was a delete.
If both inserted and deleted have rows, then it was an update.
sutharramesh...
Member
7 Points
9 Posts
How would i know in trigger which operation(insert/delete/update) is performed on a table.
Jan 29, 2013 02:09 PM|LINK
I have a trigger, which is fired on insert,update and delete.
How would i know in trigger which operation(insert/delete/update) is performed on a table.
TabAlleman
All-Star
15727 Points
2721 Posts
Re: How would i know in trigger which operation(insert/delete/update) is performed on a table.
Jan 29, 2013 02:22 PM|LINK
You can check SELECT COUNT(*) in inserted and deleted.
sutharramesh...
Member
7 Points
9 Posts
Re: How would i know in trigger which operation(insert/delete/update) is performed on a table.
Jan 29, 2013 02:25 PM|LINK
Thanks TabAlleman
Is there count in deleted table when delete event is fired?
what for delete event?
and what for update event?
TabAlleman
All-Star
15727 Points
2721 Posts
Re: How would i know in trigger which operation(insert/delete/update) is performed on a table.
Jan 29, 2013 03:00 PM|LINK
If only the inserted table has rows, then it was an insert.
If only the deleted table has rows, then it was a delete.
If both inserted and deleted have rows, then it was an update.