Home Forums SQL Server 2005 T-SQL (SS2K5) How many triggers can be implemented in a single table RE: How many triggers can be implemented in a single table

  • 1. Well the question is simple. How many triggers can be implemented in a single table.

    Effectively unlimited, although you can only have 1 INSTEAD OF INSERT, 1 INSTEAD OF UPDATE and 1 INSTEAD OF DELETE trigger

    2. If a table has 5 Insert triggers, which trigger will execute first.

    You can use the stored procedure sp_settriggerorder to define the trigger that fires FIRST and/or LAST... the rest will fire in an undefined sequence.

    If you are looking to have that many triggers, and the sequence is important, I would seriously consider combining them into a single trigger.

    The "triggers are evil" brigade will probably suggest you move the logic elsewhere, and do away with the triggers entirely.