Query Statement in Import Wizard -
05-11-2005
, 10:58 AM
I'm working on a DTS Package that will need to be scheduled to pull data
from a table on remote server, which I know can mostly be done via wizard.
My question concerns the query statement used to select data within the
wizard.
The basic remote table (tblDealer) structure is this:
DealerID [PK] int, DealerName varchar(100), StreetAddress varchar(250),
City varchar(100), State int, ZipCode char(10), etc.
The destination table is of the same name and structure. What I want to
accomplish is this:
If a DealerID on the remote server is found to exist on the destination
server, then update that DealerID with the matching entries from the remote
server; otherwise, add the new DealerID and it's entries. In other words,
something along the lines of IF EXISTS UPDATE, ELSE INSERT INTO.
Could anyone offer a coding example, or a suggestion for a better way to do
this. I was thinking that this would be the 'cleanest' under the given
circumstances, but you guys may see a much better solution.
Ideally, this remote server will be taken out of the loop. But for now I'm
stuck with this process until a few 'data review' issues can be resolved.
For similar reasons I can't just copy the remote table.
Any help is appreciated. Thanks.
--
Message posted via http://www.sqlmonster.com |