Results 1 to 5 of 5

Thread: Trigger

  1. #1
    Join Date
    Jun 2003
    Posts
    294

    Lightbulb Unanswered: Trigger

    Hello, I've got 4 triggers on the table A, all of them are executed when an insert occurs, which trigger is executed first (how does the dbms which one is going to be executed first) ??? Could I assign a priority for triggers execution ???

    Thanks

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    they fire in the order they were created. you can use sp_settriggerorder to change that.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    I beleive they execute in the order they are created...

    But why not just combine them all into one..you'd elimiate some overhead

    But there is a way I think to order...just never made any sense to me
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Mar 2005
    Location
    Netherlands
    Posts
    280
    Sorry to disappoint anyone but there's realy no way of telling in what order different triggers are execute:

    Quote Originally Posted by BOL
    The first and last AFTER triggers to be executed on a table may be specified by using sp_settriggerorder. Only one first and one last AFTER trigger for each of the INSERT, UPDATE, and DELETE operations may be specified on a table; if there are other AFTER triggers on the same table, they are executed randomly.

  5. #5
    Join Date
    Jun 2003
    Posts
    294
    Thank you so much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •