Skip to content
Microsoft SQL Server

SQL Server Error 7202

Could not find server in sys.servers

Severity 11 Linked Servers
Applies to: All supported SQL Server versions (2016 to 2025), Azure SQL Managed Instance
Last technically reviewed 23 October 2026 on SQL Server 2025 (17.0.1145.4)
The full message
Msg 7202, Level 11, State 2, Line 1
Could not find server 'SALESSRV01' 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.
Other forms of this message
Server name with an instance name
Could not find server 'SALESSRV01\SQL2022' 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.
Error number
7202
Severity
11 (user-correctable error)
State
2
Product
Microsoft SQL Server Database Engine
Versions
All supported SQL Server versions (2016 to 2025), Azure SQL Managed Instance
Last reviewed
23 October 2026

What it means

Error 7202 means a query used a server name (in a four-part name, OPENQUERY, EXEC ... AT or a remote procedure call) that is not defined as a linked server on the instance running the query.

In SALESSRV01.Sales.dbo.Orders the first part is not a network host name: it is the name of a linked server that must exist in sys.servers on the instance where the query runs. SQL Server looks the name up before it contacts anything, so 7202 never involves the network. The name in quotes in the message is exactly what SQL Server searched for.

The usual story is that the code was written on a server where the linked server exists, and then runs somewhere it does not: another environment, a restored or migrated instance, or a linked server created under a different alias. Level 11 means the object was not found; nothing ran on the remote side.

Common causes

  • No linked server with that name exists on this instance (it was never created, or the code moved to a new server, test environment or failover partner where it was not recreated).
  • The linked server was created under a different name or alias than the one in the query (for example an IP address, a fully qualified name, or a short name).
  • A typo or missing brackets: names that contain a backslash, dot or hyphen must be bracketed, such as [SALESSRV01\SQL2022].
  • The query meant to read a local database but a four-part name was used by mistake; for local objects use a three-part name.
  • After renaming the Windows host, @@SERVERNAME still holds the old name, and code that builds names from it points at a server that is not in sys.servers.

Diagnose it

Read-only These queries only read metadata and dynamic management views. They do not change data, permissions or configuration, so they are safe to run first.

Which linked servers exist on this instance?

SELECT server_id, name, product, provider, data_source,
       is_linked, is_data_access_enabled, is_rpc_out_enabled
FROM sys.servers
ORDER BY server_id;
What to look for

The name in the error must match a name here (row 0 is the local server). If the remote server is listed under another name, use that name, or check data_source to find the right entry.

Which server am I connected to?

SELECT @@SERVERNAME AS server_name, SERVERPROPERTY('ServerName') AS current_name,
       SERVERPROPERTY('MachineName') AS machine_name;
What to look for

Confirms you are on the instance where the linked server is supposed to exist. If server_name and current_name differ, the host was renamed and @@SERVERNAME is stale.

Which modules reference the server name?

SELECT OBJECT_SCHEMA_NAME(object_id) AS schema_name, OBJECT_NAME(object_id) AS object_name
FROM sys.sql_modules
WHERE definition LIKE N'%SALESSRV01%';
What to look for

Views, procedures and functions in the current database that hard-code the name. Change SALESSRV01 to the name from the error. These are the objects to fix or to point at a synonym.

How to fix it

Each fix is labelled with what it changes. Try read-only checks and the least invasive fix first, and test changes outside production.

Use the name that exists in sys.servers

Client or network side

If the linked server exists under another name, change the query to that name. For a local database, drop the server part and use a three-part name such as Sales.dbo.Orders.

Create the linked server on this instance

Changes configuration

If the linked server is genuinely missing (for example after a migration), create it with the same name the code uses, then map logins with sp_addlinkedsrvlogin using a remote login that has only the permissions the queries need. Test it with sp_testlinkedserver.

Caution: A linked server lets local users run queries on the remote server under the mapped credentials. Map only the local logins that need it, avoid mapping everyone to a highly privileged remote login, and review who can use it.

EXEC master.dbo.sp_addlinkedserver
     @server = N'SALESSRV01', @srvproduct = N'',
     @provider = N'MSOLEDBSQL', @datasrc = N'salessrv01.contoso.com';

EXEC master.dbo.sp_testlinkedserver N'SALESSRV01';

Hide the server name behind a synonym

Changes schema

A synonym such as dbo.RemoteOrders for SALESSRV01.Sales.dbo.Orders keeps the server name in one place, so moving code between environments means changing one synonym instead of every query.

CREATE SYNONYM dbo.RemoteOrders FOR SALESSRV01.Sales.dbo.Orders;

Examples

A four-part name for a server that is not defined

-- No linked server called SALESSRV01 exists on this instance
SELECT TOP (10) * FROM SALESSRV01.Sales.dbo.Orders;
Result
Msg 7202, Level 11, State 2, Line 2
Could not find server 'SALESSRV01' 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.

Reproduced on SQL Server 2025 (17.0.1145.4), 23 October 2026.

OPENQUERY with an unknown linked server

SELECT * FROM OPENQUERY(SALESSRV01, 'SELECT 1 AS x');
Result
Msg 7202, Level 11, State 2, Line 1
Could not find server 'SALESSRV01' 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.

Reproduced on SQL Server 2025 (17.0.1145.4), 23 October 2026.

How to prevent it

Script linked servers (and their login mappings) as part of each server build and migration runbook, with the same names in every environment, so code that works in test also resolves in production. After a failover or restore to another instance, compare sys.servers on both.

Reference remote tables through synonyms or a small set of views, not hard-coded four-part names spread across many procedures.

Common questions

I can ping the server, so why does SQL Server not find it?

Because the first part of a four-part name is a linked server name looked up in sys.servers on your instance, not a host name. SQL Server never contacts the network for 7202; create the linked server or use the name it already has.

Do I need a linked server to query another database on the same instance?

No. Use a three-part name such as OtherDb.dbo.TableName. A four-part name with the local server name only works if that name is in sys.servers.

Does the remote access server option fix 7202?

No. That option is about old-style remote server connections, not linked server definitions or login mappings. 7202 is fixed by using or creating the right entry in sys.servers.

Learn more on CodeWithSQL

Official documentation

Last technically reviewed 23 October 2026; examples and diagnostics run on SQL Server 2025 (17.0.1145.4). Message text checked against the engine's sys.messages catalogue.

Still stuck on a SQL Server error?

Browse the full SQL Server error library, or get hands-on help from an experienced SQL professional.