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,Only once, and ALL of the rows are in the inserted table.
--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf
"JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
news:B90E6B36-CA4C-49C0-B4C2-268CA0A241A7@.microsoft.com...
> In case of a bulk insert, the "FOR INSERT" trigger fires for each recod or
> only once?
> Thanks,
>|||To add to Arnie's response, the trigger is fired one for each batch of
records and only if FIRE_TRIGGERS is specified.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
news:B90E6B36-CA4C-49C0-B4C2-268CA0A241A7@.microsoft.com...
> In case of a bulk insert, the â'FOR INSERTâ' trigger fires for each recod or
> only once?
> Thanks,
>|||Hi Jim
The BULK INSERT statement has a FIRE_TRIGGERS option and BCP has it as a
hint, to make INSERT triggers fire. See Books Online for more.
John
"JIM.H." wrote:
> In case of a bulk insert, the â'FOR INSERTâ' trigger fires for each recod or
> only once?
> Thanks,
>

No comments:

Post a Comment