Connecting Tech Pros Worldwide Forums | Help | Site Map

Unable to join 2 tables which are in 2 differenet servers

Newbie
 
Join Date: May 2007
Posts: 5
#1: 3 Weeks Ago
Hi all,

I am trying to get the data from 2 tables which are in 2 different servers , to get that i have used
"sp_addlinkedserver" .Using this I am able to connect to the server also .I have used the following commands

for example my server ip is 11.12.23.121

EXEC sp_addlinkedserver '11.12.23.121'
EXEC sp_addlinkedsrvlogin @rmtsrvname = '11.12.23.121'

after this I am not bale to get the results of the linked server using following query

select * from '11.12.23.121'.testdb.dbo.userreg

Please tell me how to get the data from the linked server.

Thanks in advance

ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,925
#2: 3 Weeks Ago

re: Unable to join 2 tables which are in 2 differenet servers


Try:
Expand|Select|Wrap|Line Numbers
  1.  
  2. select * from [11.12.23.121].testdb.dbo.userreg
  3.  
  4.  
What error did you get?

Good luck!!!

--- CK
Newbie
 
Join Date: May 2007
Posts: 5
#3: 3 Weeks Ago

re: Unable to join 2 tables which are in 2 differenet servers


Hi ,

Thank you for your reply ,

I have tried to get the data as said by you but I ma getting the following error

"OLE DB provider "SQLNCLI" for linked server "[server]" returned message "Login timeout expired".
OLE DB provider "SQLNCLI" for linked server "[server]" returned message "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.".
Msg 53, Level 16, State 1, Line 0
Named Pipes Provider: Could not open a connection to SQL Server [53]. "


can you please tell me how to get rid of this.

Thank you
Reply