May 21, 2004 at 6:44 am
Hello all,
I am new to SQL Server and to DTS. I am trying to load a flat file using DTS Designer into target tables in SQL server. My target tables have two standard columns last update date and last updated by and they are not supplied in the flat file. I have created a trigger on my target table to automatically fire when updates and inserts take place. The mapping works when executed and inserts all the flat file data but the last update date and last updated by columns are still empty. The trigger is somehow not firing. Is there anything I need to do explicitly to make this work. Any help would be appreciated.
Thanks...
Srini.
May 21, 2004 at 7:40 am
Try changing the trigger to be an UPDATE statement that gets executed directly after the BULK INSERT step is complete in the DTS package. I believe the problem is that the BULK INSERT process will not activate the trigger.
Good Hunting!
AJ Ahrens
webmaster@kritter.net
May 21, 2004 at 7:49 am
Also check the Fast Load option in the package - if it is checked it is doing a Bulk copy insert.
Darrell Parrish
La Crosse, WI
May 21, 2004 at 7:51 am
Thanks for the response. I am not using the BULK INSERT task in my mapping. I am using the Transform data task. Are you advising to change this. Below is the body of my trigger
CREATE TRIGGER test_trigger ON dbo.test_table
FOR INSERT,UPDATE
AS
Update test_table
Set LAST_UPDT_ID =SYSTEM_USER, Last_Updt_DT= GetDate()
FROM Inserted
WHERE test_table.id = Inserted.id
Thanks,
Srini
May 21, 2004 at 7:56 am
In the properties of the transformation task on the last Tab "Options" there is an option under SQL Server to use a Fast Load which is the same as a Bulk Load/Copy. Turn this off, it should then allow the trigger to fire.
Darrell Parrish
La Crosse, WI
May 21, 2004 at 8:01 am
Thanks Darrell !!! It worked.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply