TRIGGER
There are
BEFORE (trigger)
AFTER (trigger)
In BEFORE Trigger .
There is no keyword in MS sql. Instead it defines for.
It is a default trigger
In AFTER Trigger.
There is a keyword in MS sql.i,e After.
We can get rows which are stored in temporary table by trigger.
Insert / update
Get values from inserted. ( select * from inserted) (copy of a row(s) effected).
Delete
Get values from deleted . ( select * from deleted) (copy of a row(s) effected).
During UPDATE
On Before trigger – we can get row which is not effected by a update in deleted table.
Basically we get rows from deleted table when we are maintaining log/history table.
On After trigger – we can get row which is effected by a update in inserted table.
Note : there is no updated temporary table.