Trigger does not fire after SqlBulkCopy

  • Follow


Hi all,
I have an application that fill a table with a SqlBulkCopy (WinForm in C#).
The table has a trigger that clean the null records.
But this trigger does not fire after this bulk insert.

How can I accomplish this task?

Thanks in advance. 

Luigi
0
Reply Utf 12/3/2009 3:13:01 PM

Try setting the SqlBulkCopyOptions to FireTriggers in the SqlBulkCopy 
constructor.

"Luigi" <Luigi@discussions.microsoft.com> wrote in message 
news:B894A203-F621-4766-AE24-D5E13005D968@microsoft.com...
> Hi all,
> I have an application that fill a table with a SqlBulkCopy (WinForm in 
> C#).
> The table has a trigger that clean the null records.
> But this trigger does not fire after this bulk insert.
>
> How can I accomplish this task?
>
> Thanks in advance.
>
> Luigi 


0
Reply Michael 12/3/2009 4:18:32 PM


1) per here in SQL 2005 BOL 
(ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/5dc171a0-f4f2-4a6c-8bde-d5a3c5f4c212.htm) 
the default action for bulk copy is to DISABLE TRIGGERS prior to insert.

2) I wouldn't be surprised if your trigger code isn't set up to do just one 
row and now N rows since that is a VERY common error with trigger 
programming.


-- 
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net


"Luigi" <Luigi@discussions.microsoft.com> wrote in message 
news:B894A203-F621-4766-AE24-D5E13005D968@microsoft.com...
> Hi all,
> I have an application that fill a table with a SqlBulkCopy (WinForm in 
> C#).
> The table has a trigger that clean the null records.
> But this trigger does not fire after this bulk insert.
>
> How can I accomplish this task?
>
> Thanks in advance.
>
> Luigi 


0
Reply TheSQLGuru 12/3/2009 4:28:12 PM

2 Replies
731 Views

(page loaded in 0.097 seconds)


Reply: