Question : SQL Database triggers for update and insert...

I have a table where we insert and update data.

I'm wondering if a trigger would be the correct way to go for what I want to do.

I am basically inserting some values into a BatchProcessing table.  I want to then when a value is inserted, have a trigger that will take some of the data that was inserted and then insert it into another table.

The problem with this, when using a trigger, do you know what row was inserted?  

Same with the update, do you know what row was updated?  because inserts and updates are going to happen very quickly, and there is no way to really search what was inserted.

Answer : SQL Database triggers for update and insert...

create trigger tr_BatchProcessShipments_I
on BatchProcessShipments
after INSERT
AS
begin
insert into Xcarriershipping(interface, companyname, shippingcost)
select batchnumber, companyid, cost
from inserted
end
go

the names of the tables actually are INSERTED and DELETED.  
http://msdn.microsoft.com/en-us/library/ms191300.aspx
Random Solutions  
 
programming4us programming4us