April 9, 2010 at 7:37 am
I am using SQL Server Express 2008.
I created a Trigger that I want to Execute when I import data into a table. Below is the code I wrote for the Trigger. When I use the Import Wizard to import the file into the table everything imports fine but the Trigger doesn't execute. Any idea what I may be doing wrong?
--CREATE BY BRIAN CONNER ON 4/8/2010
--TRIGGER WILL UPDATE THE BAD DEBT TABLE WITH SAW999 WHERE REJECTION CODE IS NULL
CREATE TRIGGER [dbo].[Update_REJ_With_Saw999]
ON [TEST].[dbo].[Tbl_Bad_Debt]
FOR INSERT
AS
BEGIN
UPDATE TEST.dbo.Tbl_Bad_Debt
SET REJ = 'SAW999'
WHERE REJ IS NULL OR REJ = ' '
END
April 9, 2010 at 8:19 am
By default, triggers don't fire on a bulk operation. There's a switch to turn on to make triggers fire, but I can't find it on the Wizard. Maybe there's in the SSIS package only, not in the Wizard.
You could use the BULK INSERT statement with the FIRE_TRIGGERS switch.
-- Gianluca Sartori
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply