|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, May 31, 2005 1:51 PM
Points: 2,
Visits: 1
|
|
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 in Oracle and place them in a 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!
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Tuesday, February 12, 2008 5:32 AM
Points: 1,758,
Visits: 2
|
|
INSERT INTO tblPID SELECT PID, PID_Date FROM LinkedServer.Database (Catalog?).Owner.Table ???
Good Hunting!
AJ Ahrens
webmaster@kritter.net
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, May 31, 2005 1:51 PM
Points: 2,
Visits: 1
|
|
Many thanks for the reply AJ When I first read your reply, I wondered if I'd been a complete bonehead and not gone to the obvious solution  However, it turns out I may not have explained myself too well! I would like to query only the pids (and therefore return all rows associated with each pid )associated from the original results set, not all the pids in the entire database/ Many thanks again! Rob
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Tuesday, February 12, 2008 5:32 AM
Points: 1,758,
Visits: 2
|
|
If that is the case then INSERT INTO tblPID SELECT PID, PID_Date FROM LinkedServer.Database (Catalog?).Owner.Table L1 INNER JOIN tblPID T1 ON L1.PID = T1.PID NOTE: This is only sample code and you will need to tweak it to NOT pull dates you already have 
Good Hunting!
AJ Ahrens
webmaster@kritter.net
|
|
|
|