Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Query on AS400 Table

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
I finally got the linked server to work!! I am using a linked server to an AS400. I can see all the tables I need but how can I open or query them?? I am a little new to SQL2000 so im sorry.

what I am trying to do is download data from the as400 and insert it into another table. but if the record already has been inserted I want it to skip that record. see we receive truck loads all day long. i donot want to duplicate records.

Thanks dvannoy@onyxes.com
 
I'm not sure how you open or query your tables, but once you do, here is the sql I use to do something very similar, which works well:

INSERT INTO <destination_table_name>
SELECT *
FROM <source_table_name>
WHERE <source_table_name>.fieldname not in(select <destination_table_name>.fieldname from <destination_table_name>)

Now, the fieldname would be the field defines the link between the two tables. (i.e. Customer #)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top