SQL Server triggers - order of execution

前端 未结 10 1200
旧时难觅i
旧时难觅i 2020-12-16 09:39

Does anyone know how SQL Server determines the order triggers (of same type, i.e. before triggers) are executed. And is there any way of changing this so that I can specify

10条回答
  •  无人及你
    2020-12-16 10:33

    Using SetTriggerOrder is fine, but if your code depends on a specific sequence of execution, why not wrap all your triggers into stored procedures, and have the first one call the second, the second call the third, etc.

    Then you simply have the first one execute in the trigger.

    Someone in the future will be grateful that they didn't have to dig around in a system table to determine a custom execution sequence.

提交回复
热议问题