They can be executed automatically on the INSERT, DELETE and UPDATE triggering actions.
Types of triggers:
1. INSTEAD OF:
A trigger that fires before the INSERT, UPDATE, or DELETE statement is conducted.
CREATE TRIGGER trigger name
ON table name
INSTEAD OF operation AS DML statements
2. AFTER:
AFTER triggers are executed after the action of the INSERT, UPDATE, or DELETE statement is performed.
CREATE TRIGGER trigger name ON table name AFTER operation AS DML statements
Note:
INSTEAD OF triggers may be defined on views where as AFTER cannot.
No comments:
Post a Comment