Reputation: 5072
Sorry but I'm struggling with the online documentation.
What exactly is the difference for a FOR trigger compared to a AFTER and INSTEAD OF?
Thanks
Upvotes: 1
Views: 62
Reputation: 31239
The FOR
and the AFTER
trigger is the same. You specify them in the same way and they do the same thing:
CREATE TRIGGER sometrigger on sometable FOR INSERT,UPDATE,DELETE
CREATE TRIGGER sometrigger on sometable AFTER INSERT,UPDATE,DELETE
The INSTEAD OF
trigger is something completely different. When you specify a trigger with the instead of then the trigger will execute instead of the insert, update and delete. This can be useful when you have views. So you can control what should be delete, updated and inserted in the views underlying tables
Here is an link to explain the triggers in more depth
Upvotes: 3