Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Join 2 different database servers?

Author  Topic 

jrockfl
Posting Yak Master

223 Posts

Posted - 2005-07-22 : 11:48:27
Right now I am querying 2 tables in 2 different dbs on the same server. Is it possible to query a table on a different db server?

SELECT PUSR, PLIN
FROM SECFIL.dbo.UPLNM
INNER JOIN ITEMBL ON SECFIL.dbo.UPLNM.PLNR = AMFLIB.dbo.ITEMBL.PLANIB
WHERE ITNBR = '#Session.arrParts[i][3]#'

shan74
Starting Member

2 Posts

Posted - 2005-07-22 : 12:05:23
You should be able to do this as long as you have added the other server in your linked servers. For adding the other server to the linked server,
goto the SQL Enterprise manager, select security-->Linked servers-->Add linked server. Please give appropiate privilege for the login you are using to access the linked server.
Go to Top of Page

jrockfl
Posting Yak Master

223 Posts

Posted - 2005-07-22 : 13:10:45
Yeah they are linked up, what would the SQL look like?
Go to Top of Page

shan74
Starting Member

2 Posts

Posted - 2005-07-22 : 14:17:37
select [A.columnlist], [B.columnlist]
from localserver.dbname.dbuser.table A,
linkedserver.dbname.dbuser.table B
where A.columnlist = B.columnlist (or the join condition you want)
Go to Top of Page
   

- Advertisement -