Reputation: 3932
Today I encountered a problem saying that my "server" could not be found in sys.servers. The error was:
Could not find server 'DB name' in sys.servers
It's not an issue of using a prefix in certain cases but not others as with the "dbo" issues that others were having.
Upvotes: 4
Views: 31206
Reputation: 71
If you are trying to access your database from a different server and you get this message then add a linked server. (sp_addlinkedserver)
if you are trying to access your database on the same server then check if it is registered. select * from sys.sysservers
Upvotes: 7
Reputation: 3932
There are a lot of situations where you can get this error, and many of them are covered on StackOverflow. However, one case which might especially be encountered on shared servers is simply that the database name has a period (dot) in it. For example, if its name is mysite.com_DB
. This will automatically cause the problem.
The solution, if you can't rename the database, is to encapsulate the DB name in square brackets, so for example:
mysite.com_DB.Table_name
Will turn into:
[mysite.com_DB].Table_name
Upvotes: 5