Today I encountered a problem saying that my "server" could not be find 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.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With