Solved

Problem Understanding sp_addlinkedserver

Posted on 2010-09-09
6
864 Views
Last Modified: 2012-06-21
I know this should be straight forward, but cannot get it to work...

Scenario...
2 servers, both running SQL 2005
     Server A
     Server B

I need to link to Server B from Server A to run queries

I am assuming sp_addlinkedserver to be the way to go....so....

I executed the following query from Server A...(obviously the names have been changed to protect the innocent)

exec sp_addlinkedserver
      @server='myFriendlyName',
      @provider='',
      @srvproduct='',
      @datasrc='actualServername',
      @catalog='actualDBName'

Response was "Command(s) completed successfully."

I then try to run a query as such....

SELECT *
FROM myFriendlyName.[actualDBName].[tableName]
WHERE description like '%stuff%'

Intellisense doesnt like it, but I ran it anyway and got the following error....

Msg 208, Level 16, State 1, Line 6
Invalid object name 'myFriendlyName.actualDBName.tableName'.



Response
0
Comment
Question by:JayFromPep
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 33637627
SELECT * FROM myFriendlyName.[actualDBName].dbo.[tableName]WHERE description like '%stuff%'
0
 
LVL 5

Author Comment

by:JayFromPep
ID: 33637792
Thanks Angel!

got a bit farther and new error....

Msg 7403, Level 16, State 1, Line 6
The OLE DB provider "" has not been registered.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 33637836
you have to tell that the remote is sql server also:
http://msdn.microsoft.com/en-us/library/ms190479.aspx

exec sp_addlinkedserver
      @server='myFriendlyName',
      @provider='',
      @srvproduct='SQL',
      @datasrc='actualServername',
      @catalog='actualDBName'

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Author Comment

by:JayFromPep
ID: 33637871
OK, new stuff....

Here is what I used to create the linkedserver....


exec sp_addlinkedserver
      @server='myFriendlyName',
      @provider='SQLNCLI',
      @srvproduct='',
      @datasrc='actualServerName\actualDBName'

Worked....but now I am getting login errors....

OLE DB provider "SQLNCLI10" for linked server "myFriendlyName" returned message "Login timeout expired".
OLE DB provider "SQLNCLI10" for linked server "myFriendlyName" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".
Msg 65535, Level 16, State 1, Line 0
SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 33637932
article to start troubleshooting the connection:
http://www.experts-exchange.com/A_1881.html
0
 
LVL 5

Author Comment

by:JayFromPep
ID: 33639022
hmmm....went through the doc, but no luck.  username and password is good (as dbo), remote connections are allowed.

Perhaps there is something else I am forgetting in sp_addlinkedserver command....

exec sp_addlinkedserver
      @server='myFriendlyName',
      @provider='SQLNCLI',
      @srvproduct='',
      @datasrc='actualServer\actualDB',
      @provstr='User ID=username;password=password'
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Remove () 10 41
store vs query adhoc - no show rows 4 37
Restore a log backup compressed 3 17
Group ordersum by orderdate 3 21
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question