Saturday, February 25, 2012

Only copy missing rows from one database to another

Hello everyone,

I'm trying to create a performant script to copy records from a table in a source database, to an identical table in a destination database.

In SQL 2000, I used to create a little lookup which did a count using certain fields. If the record was missing, I executed an INSERT query, otherwise an UPDATE query. The result was that the table on the destination side was always up to date. Duplicate rows were out of the question.

This was, if I'm not mistaking, a Data Transformation, using a bit of custom VBA code to govern the transfer. For each source row, the custom code was executed. Depending on the result of the custom code, a different query was launched.

Now I'm trying to do the same using SSIS in SQL 2005. Is there a task which does this for me, or do I have to script again? In the latter case, which type of task would I use?

(I thought of the Script Task, but then I would need to set up quite a bit myself.)

Thank you,

Bram

Look at the "checking to see if a record exists if so update else insert" post on the main page.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1211340&SiteID=1

No comments:

Post a Comment