Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Multiple trigger execution order

Author  Topic 

BruceT
Yak Posting Veteran

78 Posts

Posted - 2009-07-08 : 11:07:26
True or false, multiple update triggers on a table will fire in the order they were created unless otherwise specified?

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-08 : 11:52:54
The order is set by sql server, however you can use the system sp sp_settriggerorder to set the first and last trigger
Go to Top of Page

BruceT
Yak Posting Veteran

78 Posts

Posted - 2009-07-08 : 12:18:20
quote:
Originally posted by visakh16

The order is set by sql server, however you can use the system sp sp_settriggerorder to set the first and last trigger



Thanks visakh, I understand this. All of the testing I've done indicates that the order sql server assigns is based on creation sequence. I'm just trying to determine if that is in fact the case.

As a test I created 5 update triggers on a table, they always seem to fire in the order that they were created. If I drop them and recreate them in a different order that becomes the order they fire in. Does anyone know if that's the case or not?

Thanks

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-08 : 12:26:15
yup. when you drop and recreate them it does alter that triggers order of firing
Go to Top of Page
   

- Advertisement -