0

I have 2 Triggers on a table : Tr1 , Tr2 .

I didn't set order to any.

my question :

If I set to Tr1 sp_settriggerorder with "first" value.

Does it say implicitly that Tr2 will be the second one automatically?

Or should I also use sp_settriggerorder with "last" value to the Other Trigger ?

1
  • What would be the only sensible implementation of this? Commented Nov 21, 2011 at 13:32

1 Answer 1

1

As Martin Smith alludes in his comment. If you only have two triggers and one has been designated as first. Then the remaining trigger has to fire second. That is proper application of ordering when you have two triggers.

For a very thorough explanation of trigger ordering read this article

but in summary...

  • If you have 2 triggers you only need to designate a first OR a last to ensure a firing order.

  • If you have 3 triggers you must designate BOTH a first and a last to ensure firing order. The third trigger won't have an order but since it's the only one left it automatically gets fired 2nd.

  • If you have four or more triggers, you may designate a first and a last but the others will fire in an arbitrary order somewhere in the middle. You may also want to have a 'pshrink' on retainer if you regularly have four or more triggers on a table.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.