Discussion:
Multiple Update Triggers against a single table
(too old to reply)
GWTNewbie
2012-02-24 17:10:55 UTC
Permalink
Hello,

I'm looking into creating an update (DDL) trigger for a specific table of my client's database. However, this table already has an update trigger. What is the consequence of having another update trigger against the same table? Are both executed or does SQL Server choose one at 'random' to execute?

I'm asking because I'm deciding whether to remove/deactivate their current trigger and create my own or simply add my own trigger along with the one they currently use.

The client is using SQL Server 2005. I did a cursory search on this newsgroup before posting but did not find anything relating to my question.

If this question is already asked and answered, a link to the answer would suffice.

Any ideas?
Erland Sommarskog
2012-02-24 19:15:44 UTC
Permalink
Post by GWTNewbie
I'm looking into creating an update (DDL) trigger for a specific table
of my client's database. However, this table already has an update
trigger. What is the consequence of having another update trigger
against the same table? Are both executed or does SQL Server choose one
at 'random' to execute?
Both are executed. In a non-deterministic fashion, that is, you don't
know which executes first. However, you can use sp_triggerorder to define
a trigger as the first or the last trigger.
--
Erland Sommarskog, SQL Server MVP, ***@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
Loading...