Possibly a synonym, that in turn points to a linked server. Check out what synonyms you have in that database, if any of those points to a linked server, and the queries in your proc, if any of those uses that synonym.
Could not find server 'Servernamehere' in sys.servers. Verify that the correct server name was specified.
Hello,
we have two SQL servers, lets call them A and B. A is our old server, SQL Server 2014 and B is our new server, SQL Server 2019.
Both servers are single servers as in not linked servers or connected to each other in any way.
Our server guys backed up a database in server A and restored it to server B. When I try to execute a stored procedure on the new server B,
I get an error saying "Could not find server 'A' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers"
The particular stored procedure I tested, does not update anything in that database, although we do have those as well.
There are no references to a particular server in the procedure code.
Does anyone have an idea as to why this could've happened or how I could solve this without adding any linked server references into sys.servers?
Best regards,
Tunkkari
6 additional answers
Sort by: Most helpful
-
Tom Phillips 17,716 Reputation points
2022-04-19T15:32:18.413+00:00 Somewhere you have a 4 part name. It could be anywhere.
That error does not mean you had a linked server. It means somewhere in your code you have "A.database.schema.object".
-
Naomi 7,361 Reputation points
2022-04-19T16:17:23.787+00:00 If you don't see what in the procedure code (4 parts name or name of the server with two dots and then name of the table) then there is a possibility of a trigger on a table involved.
-
CathyJi-MSFT 21,096 Reputation points Microsoft Vendor
2022-04-20T07:15:59.887+00:00 Hi @Tunkkari ,
Any update for this thread? As others mentioned, please check if you have 4 part name in this procedure code( such as select *from A. dbo.table1). If yes, please change A to B.
Please using below T-SQL to check server name.
select name from sys.servers
If the server name is no correct, please use below T-SQL to drop the old server name and add the new server name to sys.servers on the new server
sp_dropserver 'Server_A' GO sp_addserver 'Server',local GO
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
-
Erland Sommarskog 101.4K Reputation points MVP
2022-04-19T22:04:43.99+00:00 The error message should have procedure name and line number to where this occurs. If the procedure name is missing, this indicates that is dynamic SQL. In that case, you may have to use Profiler to find out where it happens.
Note that if you say
SELECT * FROM A.db.dbo.tbl
on server A, SQL Server simply ignores A, since it is knows that is on A. But that is of course not the case when the database is on B.