?
Solved

You cannot create a Local sql Server as a Link server

Posted on 2005-04-17
6
Medium Priority
?
243 Views
Last Modified: 2012-08-14
Dear ALL,

                I have inherited a server which shows following massage when I use 4 part table name.

My query is:

select
         sum(amount) AS Event
 from MylocalServer.RA_P07.dbo.P07_C60A21_stage


Server: Msg 7202, Level 11, State 2, Line 1

Could not find server ' MylocalServer ' in sysservers. Execute sp_addlinkedserver to add the server to sysservers.

 
When I use sp_addlinkedserver from Enterprise Manager it shows following Error:
    You cannot create a Local sql Server as a Link server

 And on sysservers table I have found no entry for MylocalServer

 Can any one Help me on that

 Thanks In Advance

Muntasir

0
Comment
Question by:muntasirrahman
  • 4
  • 2
6 Comments
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13801093
When referencing objects on the local server, you don't need to specify the server name.  You only use the 4-part table name if you are referencing objects from other servers.  Given this, you query should look like this:

select
         sum(amount) AS Event
 from RA_P07.dbo.P07_C60A21_stage
0
 

Author Comment

by:muntasirrahman
ID: 13824538
i know, but  it does not create problem with my other server
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13825924
Execute this SELECT statement and tell me the values returned:

select host_name(), @@SERVERNAME
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

Author Comment

by:muntasirrahman
ID: 13842057
Dear rafranscio

@@servername shows 'NULL' value
0
 
LVL 28

Accepted Solution

by:
rafrancisco earned 200 total points
ID: 13842958
Try this and see if @@SERVERNAME gets a value:

EXEC sp_addserver 'MylocalServer', 'local'
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13842999
Once @@SERVERNAME contains a value, try your query again.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Suggested Courses

850 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