3

I have two after triggers on target table (one for insert and one for update). Now if I execute merge on the target table, the triggers are executed only once. Although the merge statement executes around 300 updates, and 200 inserts.

I checked it with print statements in each trigger, right after getting data from deleted, inserted record into variables.

How come? Is this a bug?

I have SQL Server 2008 sp1 std (part of the SBS2k8).

4

1 に答える 1

6

トリガーは、1 つのアクションごとに実行されます。「行ごと」ではありません

200 行の挿入が 1 回、300 行の更新が 1 回あります。

したがって、挿入と更新の場合はトリガーが 1 回実行されるか、個別のトリガーがそれぞれ 1 回実行されます。

編集:

于 2011-12-13T09:45:42.087 に答える