how to use trigger in bulk insert

Posted by Santosh4u under VB.NET on 3/18/2011 | Points: 10 | Views : 4355 | Status : [Member] | Replies : 1
Hi Friends,
plz anyboby help me on this.....

i am inserting the records in a table using bulk insert and i want to insert the same records in another table using trigger.
my trigger is working if i m inserting records in backend but it's not working through bulk insert.
even i tried to fire trigger front end(in vb.net) also same result .

how can i fire trigger in bulk insert...........


Regards
Santosh




Responses

Posted by: SheoNarayan on: 3/18/2011 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Hi Santhosh,

Triggers are fired once per statement not per row on the database. So you need to change the way you are inserting bulk records.

Have a look at this msdn article http://msdn.microsoft.com/en-us/library/ms188365.aspx that explains how to use triggers in Bulk insert.

Below two threads might also help you.

http://social.msdn.microsoft.com/Forums/en/sqldataaccess/thread/e44cbc34-9788-4056-8ef6-a29d0bc191c4
http://stackoverflow.com/questions/2742745/firing-trigger-for-bulk-insert

Thanks!

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response