Hi! Vikram,
Firstly My advice is to avoid Trigger for best performance. Even you will
loose your business logic if you drop your table as table depended trigger
will drop automatically. If you have any kind of business logic then you can
use funcation as alternative or there are other ways also.
As far as I know SQL Server triggers fire only once per statement, not once
per affected row. So, you'll have to create the multiple-row update!!!
Try with instead of trigger.
Thanks & Regards,
Milind Amin
9819916106
-----Original Message-----
From: Vikram G Gite
[mailto:mssqldba-ezmlmshield-x73960075.[Email address protected]
Sent: Friday, June 29, 2007 3:22 PM
To: LazyDBA Discussion
Subject: Bulk Insert with Trigger
Dear All,
Could anybody tell me how to fire a trigger while inserting bulk data inside
1 table.
for e.g I have 2 table A & B
query will be
insert into A select x,y,z from B (there are 10 records)
now I have written one trigger on insert and my trigger will insert another
5 records inside 3rd table lets assume C.
so,
A --> B (10 records)
on this insert, trigger will fire and it will insert i.e 10 * 5 = 50 records
inside C table.
Currently its not happening.
Trigger is getting fire only for 1st insert and not for all 10 inserts.
Pls tell me the solution.
ASAP.
Thanks and Regards,
Vikram G.
The information contained in this electronic message and any attachments to
this message are intended for the exclusive use of the addressee(s) and may
contain proprietary, confidential or privileged information. If you are not
the intended recipient, you should not disseminate, distribute or copy this
e-mail. Please notify the sender immediately and destroy all copies of this
message and any attachments contained in it.
Contact your Administrator for further information.
---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments contained in it.
Contact your Administrator for further information.
MS Sql Server LazyDBA home page