all groups > sql server dts > may 2007 >
You're in the

sql server dts

group:

Transform with conditions


Transform with conditions bringmewater NO[at]SPAM gmail.com
5/11/2007 7:53:21 AM
sql server dts:
I'm trying to transfer all records from Database A Table1 to Database
B Table1 getting only the records that are not currently in Database B
Table1. I have a primary key (Key1) that is in both. So basically
if this primary key does not exist in Database B Table1 then import
the record. How do I do this with DTS please?
Thank you very much in advance.
Re: Transform with conditions Allan Mitchell
5/11/2007 8:30:48 PM
Hello bringmewater@gmail.com,

Common wany to do this.

1. If the DBs are on the server then just use 3 part naming as the query

SELECT <col list> FROM <db>.<owner>.<object>WHERE <col> NOT IN (SELECT <col>
FROM <db>.<owner>.<object>)

2. Another is to stage one of the tables in the other DB and do a SQL Statement
from there

3. If the DBs are not on the same server then you may consider OPENDATASOURCE,
OPENQUERY, Linked Servers.



--

Allan Mitchell
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com |
http://www.konesans.com

[quoted text, click to view]

AddThis Social Bookmark Button