sql-servert-sqltriggers

When exactly does MSSQL Trigger fires?


I've got a trigger

"ON [tbl_options] AFTER INSERT"

It inserts '1' to the [tbl_options].[comment]

Executing this query:

INSERT INTO [tbl_options] (key, value)
OUTPUT Inserted.comment
VALUES ('timeout','100');

Will give me NULL or '1'?

In other words: Does ON AFTER INSERT triger fires before returning OUTPUT or after?


Solution

  • From msdn:

    Columns returned from OUTPUT reflect the data as it is after the INSERT, UPDATE, or DELETE statement has completed but before triggers are executed.