Thursday, March 8, 2012

Copy data between DB with DTS

Hi,

My problem is regarding copy data between two databases with an DTS package.
I have two DB, DB1 and DB2 and they both contains a tbl
named companies. Every week new companies is added two DB1
and I want a DTS package to copy that new data to DB2.
The problem is that I only wants to copy new data, otherwise I get a primary key violation. You can't add a company with the same key as another.Lookup Data Driven Query task in SQL BOL. It will allow you to check for the existence of a record on the target server and skip that record when processing. It's a little complex to use, but it works well.

One more caution, since it is a script-driven task, you may experience performance issues with very large record sets.

You may also consider using straight T-SQL and not use DTS at all. Even if the two databases are are separate servers, you can link them and use T-SQL.

Regards,

Hugh Scott

Originally posted by jrundber
Hi,

My problem is regarding copy data between two databases with an DTS package.
I have two DB, DB1 and DB2 and they both contains a tbl
named companies. Every week new companies is added two DB1
and I want a DTS package to copy that new data to DB2.
The problem is that I only wants to copy new data, otherwise I get a primary key violation. You can't add a company with the same key as another.|||You can use query statement to copy the data into db2.

Originally posted by jrundber
Hi,

My problem is regarding copy data between two databases with an DTS package.
I have two DB, DB1 and DB2 and they both contains a tbl
named companies. Every week new companies is added two DB1
and I want a DTS package to copy that new data to DB2.
The problem is that I only wants to copy new data, otherwise I get a primary key violation. You can't add a company with the same key as another.|||Originally posted by jrundber
Hi,

My problem is regarding copy data between two databases with an DTS package.
I have two DB, DB1 and DB2 and they both contains a tbl
named companies. Every week new companies is added two DB1
and I want a DTS package to copy that new data to DB2.
The problem is that I only wants to copy new data, otherwise I get a primary key violation. You can't add a company with the same key as another.

Hi,

i can recommend a tool for this problem:
http://www.sqlscripter.com

Regards
Thomas

No comments:

Post a Comment