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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Openquery insert into syntax

Status
Not open for further replies.

marta05

MIS
Jan 26, 2005
1
US
Hi;

I am trying to update the info on db2 from sql server.
I created a link server and I can get the information by running the following query:

select * from openquery(rftest1, 'select * from aqua.aqua.itin')

I would like to insert information into the itin table in db2 from sql, however.

What is the syntax please???

-Marta
 
I havent used openquery but based on openrowset syntax I think this would work.
Code:
INSERT INTO db2..itin
SELECT A.*
FROM openquery(rftest1, 'select * from aqua.aqua.itin') AS A
 
I just figured this out today. Try this:
INSERT INTO OPENQUERY(rftest1, 'SELECT field1, field2, fieldN FROM aqua.aqua.itin) SELECT field1, field2, fieldN FROM sqlTable WHERE ...continue WHERE clause....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top