SQL Server Triggers Question:

Explain trigger classes i.e. instead of and after trigger?

Tweet Share WhatsApp

Answer:

INSTEAD OF: Cause the trigger to fire instead of executing the triggering event or action. It prevents unnecessary changes to be made.

Example: Causes the trigger to fire instead of the update (action)

CREATE TRIGGER Employee_update ON Employee INSTEAD OF UPDATE AS { TRIGGER Definition }

AFTER: execute following the triggering action, such as an insert, update, or delete. These triggers are fired a little late in the process.

Example: Causes the trigger to fire instead of the update (action)

CREATE TRIGGER Employee_update ON Employee AFTER UPDATE AS { TRIGGER Definition }

Download MS SQL Server Triggers PDF Read All 10 MS SQL Server Triggers Questions
Previous QuestionNext Question
How to apply cascading referential integrity in place of triggers?What are the instances when triggers are appropriate?