Insert Trigger on a bulk inserted table

Insert Trigger on a bulk inserted table

Post by Stewart Basteras » Sun, 08 Apr 2001 05:05:25



I've gotten this far...

I have established a temporary table that receives one thousand records at
regular intervals from an application... I have two subsequent tables that
need to be inserted into as a result...

My logic was simply that the bulk insert would occur from the application...
The temp bulk table would then have an insert trigger that coordinates the
inserts into table1 and table2... The only thing is, once the record is
inserted into table1, I need it's identity column to store in table2 for
linking... At this juncture I have managed to insert into table1, and
table2, but the identity from table1 in table2 is not correct???

Can anyone assist?

tblTemp
tmpCol1, tmpCol2, tmpCol3, tmpCol4

tblOne
tblOneID(identity), frmCol1{from Bulk Inserted Tmp}, tblOneCol2...

tblTwo
tblTwoID(identity), tblOneLink{Table1 Identity}, tblTwoCol3{from Temp},
tblTwoCol4 {from Temp}, tblTwoCol5 {from Temp}

 
 
 

Insert Trigger on a bulk inserted table

Post by Jay » Sun, 08 Apr 2001 07:52:56


You have not mentioned how you are specifying identity value of table1 in
table2.


variable and then use this variable for identity value of table1 in table2.


Quote:> I've gotten this far...

> I have established a temporary table that receives one thousand records at
> regular intervals from an application... I have two subsequent tables that
> need to be inserted into as a result...

> My logic was simply that the bulk insert would occur from the
application...
> The temp bulk table would then have an insert trigger that coordinates the
> inserts into table1 and table2... The only thing is, once the record is
> inserted into table1, I need it's identity column to store in table2 for
> linking... At this juncture I have managed to insert into table1, and
> table2, but the identity from table1 in table2 is not correct???

> Can anyone assist?

> tblTemp
> tmpCol1, tmpCol2, tmpCol3, tmpCol4

> tblOne
> tblOneID(identity), frmCol1{from Bulk Inserted Tmp}, tblOneCol2...

> tblTwo
> tblTwoID(identity), tblOneLink{Table1 Identity}, tblTwoCol3{from Temp},
> tblTwoCol4 {from Temp}, tblTwoCol5 {from Temp}