TRIGGER on newly inserted rows only in SQL Server 2005
Posted on 2007-07-30
How does the trigger fire? I'm basically after an efficient way to update on a BULK INSERT in SQL Server 2005
i'm doing a BULK INSERT and want to update the new rows only after the INSERT.
As the table gets larger and larger, i do not want the conditional UPDATE to query the whole destination table of tblCustomer - I only want to query the newly inserted rows.
CREATE TRIGGER triggerA ON tblCustomer AFTER INSERT AS
SET xflag = 1
FROM tblCustomer, tblAddress
WHERE tblCustomer.customerID = tblAddress.customerID
This trigger runs across the whole of tblCustomers
Now the questions i have are
1. does the bulk insert complete on all rows, before the trigger is fired
2. how do i only run the UPDATE query against the new rows