Friday, March 23, 2012

Insert trigger for bulk insert

In case of a bulk insert, the “FOR INSERT” trigger fires for each recod or only once?

Thanks,

Once for each batch. Here's the specific text from Books Online

"Triggers are fired once for each batch in the bulk copy operation. The inserted table passed to the trigger contains all of the rows inserted by the batch."

Note that, by default, the triggers do not fire for bulk operations, you must specify the FIRE_TRIGGERS option in order to get triggers to fire for bulk operations.

|||

This option may have issues with performance if you enable during the bulk load operaton during the otherside of triggers, refer to the books online about Controlling trigger execution when bulk importing data.

HTH

No comments:

Post a Comment