I have an input record that contains the following fields:
header_id_1
header_id_2
header_id_3
header_detail_1
header_detail_2
And I have a table, that contains the following fields
header_id_1
header_id_2
header_id_3
header_detail_1
header_detail_2
Okay. The kicker here is that in the table, the header_id's are already defined, but the details are blank. I need to insert the details where the header_id's of the input equal the header_id's of the table.
Is there a loop or something? I can *almost* see it in my head if I was just writing a SQL Query, but it involves a cursor, and I'm hoping SSIS will save me some of the aggravation...
Any ideas?
Isn't this just an update?
UPDATE TABLE
SET header_detail_1 = input_header_detail1,
header_detail_2 = input_header_detail2
WHERE header_id_1 = input_header_id_1
AND header_id_2 = input_header_id_2
AND header_id_3 = input_header_id_3
You could achieve this with an OLE DB Command transformation.|||Oh, hey! Yeah! Thanks!
Jim Work
|||You could also load the flat file (or whatever source you may have) to a staging table and then issue a batch update -- which would be faster than using the OLE DB Command to perform your updates...
To perform the batch update inside SSIS, you'd use an Execute SQL task in the control flow after you've loaded the staging table with a data flow.
Inside that Execute SQL task, your query would be something like:
UPDATE destination_table a, staging_table b
SET a.column1 = b.column1, a.column2 = b.column2
WHERE a.key1 = b.key1
AND a.key2 = b.key2
AND a.key3 = b.key3
It's real similar to the above query, except that you're using native SQL to perform the update rather than SSIS.