0

How can I link two server using query in SQL? I want to remotely query the table of this Server (BL4/SQLEXPRESS) to my Server (BLSVR11). Can you show me how to do it in SQL? This is how I did it but it giving me an error..

EXEC master.dbo.sp_addlinkedserver 
@server = 'BL4\SQLEXPRESS',
@srvproduct = '', 
@datasrc = '192.168.1.1',
@provider = 'SQLNCLI10', 
@provstr = ''

EXEC sp_addlinkedsrvlogin
@rmtsrvname = 'BL4\SQLEXPRESS',
@useself = 'false',    
@rmtuser = 'ID',
@rmtpassword = 'passwd'

SELECT * FROM [BL4].[dbo].[T_Order]

Here's the error after testing the connection

Please help :(

Marc
  • 11
  • 3
  • Whenever i try to test the connection it giving me this error -- The test connection to the linked server failed. An exception occurred while executing a Transact-SQL statement or batch (Microsoft.SqlServer.ConnectionInfo) -- – Marc Dec 08 '15 at 02:57
  • Here's the other error detailed message: OLE DB provider "SQLNCLI10" for linked server "BL4\SQLEXPRESS" returned message "Login timeout expired". OLE DB provider "SQLNCLI10" for linked server "BL4\SQLEXPRESS" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL – Marc Dec 08 '15 at 03:03
  • Authentication problem. Look here and tell me if it helps https://sites.google.com/site/greateindiaclub/software-zones/database-community/sql-server/cannotinitializethedatasourceobjectofoledbprovidersqlncli10forlinkedserver – tshoemake Dec 08 '15 at 03:07
  • Also see this http://dba.stackexchange.com/questions/90925/sql-server-frequent-login-timeout-expired-in-linked-server – tshoemake Dec 08 '15 at 03:08
  • @tshoemake thank you I will check this. Will reply here the status :) – Marc Dec 08 '15 at 03:11
  • @tshoemake sorry I still got the same error with the link you've given me :( – Marc Dec 08 '15 at 04:35

0 Answers0