August 9, 2006 at 8:28 am
Hello, is there an actual way to definitively tell if an insert, update or delete trigger was fired due to a delete? In ORacle PL/SQL you can just do;
IF DELETING THEN ....
Thank you!
Best Regards,
~David
August 9, 2006 at 9:13 am
Hi,
There is no function as you described but there are a couple of ways you could achieve the same result.
You could examine the inserted and deleted tables. If there are records in both tables you know that it must be an update. If there are only records in the inserted table then you know it's an insert and if there are only records in the deleted table you know it's a delete.
Alternatively, in SQL 2005 you can capture this information from the sys.trigger_events table. So you could something like. I'd just check up on this as I haven't used this before.
@trigger_type nvarchar(60)
@trigger_type = type_desc
sys.trigger_events
object_id = object_id('my_trigger_name')
@trigger_type = 'DELETE'...
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply