Can I have two different insert triggers on the same table?

Hammad Khan picture Hammad Khan · Oct 19, 2011 · Viewed 18.8k times · Source

They seem to be allowed as I can see both my insert triggers listed under the table with different names. Is it common or a bad practice? I am using SQL Server 2005

Answer

marc_s picture marc_s · Oct 19, 2011

Yes, you can definitely have more than one trigger for each operation, e.g. AFTER INSERT or AFTER UPDATE etc. It does make sense to split up separate concerns into separate, small, manageable chunks of code.

The one thing you cannot rely on is that they'll be executed in a certain order - the order in which the triggers are indeed executed also doesn't have to be stable, i.e. the same every time around.