Friday, February 24, 2012

BULK INSERT

I trying to use the BULK INSERT command to insert data into a table.
The table has an insert trigger. The problem is that the trigger is
fired only once for the whole bulk. The trigger is fired only for the
last row inserted in the table.
HELP?A trigger is probably not the best idea for a table if you need it to fire
for every row of a BULK INSERT.
Rather, I would mae part of the BULK INSERT process call a stored procedure
that operates on that portion of the table in a set-based operation.
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"GS" <gulpreet.sandhu@.conservation.ca.gov> wrote in message
news:32b5b09a.0401301046.5fcfcd9e@.posting.google.com...
quote:

> I trying to use the BULK INSERT command to insert data into a table.
> The table has an insert trigger. The problem is that the trigger is
> fired only once for the whole bulk. The trigger is fired only for the
> last row inserted in the table.
> HELP?
|||Hi,
Can you remove the FIRE_TRIGGERS option from Bulk insert statment, this will
ensure that trigger is not getting fired during Insert.
Thanks
Hari
MCDBA
"GS" <gulpreet.sandhu@.conservation.ca.gov> wrote in message
news:32b5b09a.0401301046.5fcfcd9e@.posting.google.com...
quote:

> I trying to use the BULK INSERT command to insert data into a table.
> The table has an insert trigger. The problem is that the trigger is
> fired only once for the whole bulk. The trigger is fired only for the
> last row inserted in the table.
> HELP?
|||To do this you will have to use a format file
For an example see
http://www.nigelrivett.net/BCP_quot...ormat_file.html
Nigel Rivett
www.nigelrivett.net
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!

No comments:

Post a Comment