How to get the name of the currently executing trigger and the name of the table it is attached to, in sql server? -
i using sql server 2008
i have common line of t-sql put many triggers. want able use name of executing trigger , table name trigger attached to.
i hard code each trigger lot of work i'd avoid, there inbuilt functionality give me want?
whilst waiting answer, have discovered half of question:
object_name(@@procid)
will give me trigger name
just need table name now
ok found myself:
select name tablename, object_name(@@procid) triggername sys.objects object_id = (select parent_object_id sys.objects name = object_name(@@procid))
Comments
Post a Comment