September 15, 2002 at 1:32 pm
Hi !
I have problems in writing a script that can update one table from another. A table's data is fetched via DTS and when that is finished I want another table to be updated with that contents - if the ID exist, the fields are to be updated - else the entire row are to be inserted.
Can anybody help me ?
bent
September 16, 2002 at 12:46 am
In ur parent table where the DTS is occuring write a trigger on insert.
In that chk wheter the child table has that record in it. If it is there then update the child record, else insert into the child table.
I hope that i have understood ur problem correctly and replied properly.
September 16, 2002 at 6:39 am
Very good solution, certainly adds the check for other inserts that are not performed through DTS.
But, if the number of records through DTS is large, performance will suffer. Maybe a set-based approach after the import is a better solution in that case.
You could do that in two steps, first updating all the records that are allready present, and after that inserting the new records.
September 18, 2002 at 8:27 am
I've tried to implement a trigger in the parent table - it works fine when I insert/update manually but not when executing then DTS - doesn't a trigger work in a DTS package ?
The first thing I do in the DTS package is to delete the table and then create it again (to empty it) including creating the trigger
bent
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply