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!

SQL Server Linked Server + Query using existing recordset 1

Status
Not open for further replies.

robfromuk

MIS
Jan 14, 2004
7
CA
Environment: SQL Server 2000, Linked server setup to an Oracle 9i DB.

I have a results set in SQL Server. It has a column called pid.

pid has many more entries in the Oracle DB (also in a column called pid), spanning across many dates. The one I have in SQL Server is just one of those dates.

I would like to retrieve ALL dates associated with each pid from the above existing results, querying in Oracle and place them in a new table in SQL Server.

Additional information (though may not be so relevant): The original results set in SQL Server was taken from the Oracle DB.

Can anyone suggest a way to perform this? I was thinking some complex use of cursor but wasn't sure if this was possible through the linked server mechanism. Not sure why I added that note ... ANY solution is most welcome!

Sincere thanks in advance!
 
Something like this?

Code:
INSERT target_table (pid, date)
SELECT t2.pid, t2.date
FROM table1 t1
  JOIN oracle_server..owner.table t2 ON t1.pid = t2.pid

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top