问题
I would like to compare two tables, one from Access Mdb & one SQL server table is SSIS.
The goal is to truncate the table if there is differences and fill it with MDB source and Update the version in another table.
I am trying to do it through a lookup but the Version is incremented with the number of rows and it should be once.
The operation needs to be performed with 2 different Tables.
回答1:
How am I supposed to perform only once the update even if I have 10 No Match output rows ?
SSIS provides the OLEDB Command for performing in the pipeline updates in a data flow. However, as you have implied in your question, this performs an UPDATE command per row.
A more efficient technique for performing batch level updates is to:
- Truncate UPDATE staging table
- Detect what rows have changed in the data flow
- Direct changed rows to a destination and store the data in a staging table
Add an execute SQL command after the data flow which will perform an update from the staging table to the target table. i.e.
UPDATE T SET T.Column1 = S.Column1 , T.Column2 = S.Column2 FROM MyTarget T JOIN MySource S ON T.id = S.id
The Control flow will look like this:

EDIT: Edited Steps and image to add a step for truncating the staging table.
来源:https://stackoverflow.com/questions/28429881/ssis-compare-tables-content-and-update-another