Triggers: Instead Of and After

  • I was reading a document about triggers and the document says that can be only one Instead Of (moment of execution) Trigger per table, but can exists many After (moment of execution) Trigger, I don't understand why, if someone could explain this situacion...

  • If you think it through logically, if you had more than one INSTEAD OF trigger, how would the SQL Engine know which one to use? On the other hand, an AFTER trigger is an independent action and could have more than one action.

    i.e...

    You have an INSTEAD OF trigger that replace a Salesplan Text field with it's corresponding ID. you couldn't do this twice, as one would overwrite the other.

    You could have an AFTER trigger that applied State Tax and yet another that updated your inventory tables.

    Now, these are only rough explanations and I'm sure there's a more detailed answer.

    Hope this helps!

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • Ok, thank you for your reply, I understand your explanation, for that an instead of trigger does not fire recursively too...I suppose that the SQL Server Engine does not allow this behaviour for security purposes related with blocking issues, I don't now surely, but I just mention it...

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply