On bulk insert, Insert trigger only works for the first record and does not work for all the other records but trigger works properly when records are inserted using cursor.
Insert trigger updates few columns of destination table. To insert bulk data I am using following script
INSERT INTO DestinationTable (Column1, Column2)
SELECT * FROM SourceTable
I get few columns in trigger of inserted record like the following script, and work on them to update columns of DestinationTable
SELECT @col1 = Column1, @col2 = Column2, FROM INSERTED
- Why on bulk insert, trigger does not work?
- Am I missing something or I have to use cursor?
I am using SQLServer 2005
EDIT
Trigger Code
http://stashbox.org/957108/InsertTrigger.sql
Thanks.