snippetModerate
How to change the firing order of Triggers?
Viewed 0 times
orderthefiringhowtriggerschange
Problem
Realy I rarely use triggers. So I met a problem at first time. I have a lot of tables with triggers (2 or more for every table). I would like to know and change the order of firing triggers for every table. Is it possible to get this information?
ADDED:
Here is a good enoght article on mssqltips I have found.
ADDED:
Here is a good enoght article on mssqltips I have found.
Solution
You can use the following statement to list all triggers in each table.
Once you find out all the triggers. You can manually change the order using sp_settriggerorder
EXEC sp_MSForEachTable 'PRINT ''?''
EXEC sp_helptrigger ''?'''Once you find out all the triggers. You can manually change the order using sp_settriggerorder
Code Snippets
EXEC sp_MSForEachTable 'PRINT ''?''
EXEC sp_helptrigger ''?'''Context
StackExchange Database Administrators Q#468, answer score: 12
Revisions (0)
No revisions yet.