I’ve got an Employees table on a SQL 2005 server, and a nearly-identical Employees table on a SQL 2008 server (the servers are not linked). One table is in the production database, and the other is in a dev database. I have to pull data from production into the dev database on a scheduled basis and I’m using SSIS to build a package to do this.
I need to set up an SSIS package that will:
- Compare the two tables to determine if they are not ‘synched’. That is, to see if the prod table has rows that are not yet in the dev table.
- Only if necessary–update the dev table with just the new rows from the prod table.
I’ve muddled around with a few ways of doing this, but I’m looking for a more elegant solution than what I’ve been able to come up with. What’s the best way to do this?
The simplest way of achieving this (although possibly not the most efficient depending on your data volumes) is to feed the Production source data into a Lookup Task which is based on the Development data, looking up on the PK column(s). Set the rows that do not match (or fail if using 2005) to be redirected to a new flow – you can then use this to feed back into your Development table using an OleDb Destination.