Tuesday, 24 January 2012

Viewing Trigger Order (First and Last)

When I am going to see the trigger execution level, I find several article related to change the SQL server trigger execution lave by sp_settriggerorder

But I have a basic question in my mind, I have a table named Table-test and it contains 4 triggers when I am going to see the sp_helptrigger Table-test it display all the related trigger name. But I want to kanow which one is going to run first and which one is going to Last. I don't want to change any order.


I this this SQL statesment help you to understand which trigger is going to execute first and which one is going to execute last.


SELECT  name TriggerName,

                ROW_NUMBER() OVER (Order by modify_date Desc) ExecutionOrder

FROM     sys.triggers

WHERE  parent_id = object_id('Table-test')

ORDER BY modify_date DESC


Hope it is Informative.



No comments:

Post a Comment