Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server - AFTER UPDATE vs FOR UPDATE?

I'm trying to understand whats the difference between after update and for update triggers?

I know that instead of triggers can just override my current action.

But I don't see any difference between after update and for update

like image 699
Royi Namir Avatar asked Oct 27 '11 13:10

Royi Namir


2 Answers

after update and for update are synonyms for the same behavior, namely that the trigger fires after the update operation.

like image 52
Joe Stefanelli Avatar answered Oct 13 '22 08:10

Joe Stefanelli


They are identical.

From msdn page on CREATE TRIGGER:

AFTER is the default, if FOR is the only keyword specified.

SQL Server allows a lot of flexibility in syntax. All of the following are equivalent to each other as well:

  • LEFT JOIN and LEFT OUTER JOIN
  • INNER JOIN and JOIN
  • INSERT ... and INSERT INTO ...
  • Table AS alias and Table alias
like image 23
JNK Avatar answered Oct 13 '22 09:10

JNK