Skip to content
Microsoft SQL Server

SQL Server Error 7416

Access to the remote server is denied because no login-mapping exists

Severity 16 Linked Servers
Applies to: All supported SQL Server versions (2016 to 2025), Azure SQL Managed Instance
Last technically reviewed 24 October 2026 on SQL Server 2025 (17.0.1145.4)
The full message
Msg 7416, Level 16, State 1, Line 1
Access to the remote server is denied because no login-mapping exists.
Error number
7416
Severity
16 (user-correctable error)
State
1
Product
Microsoft SQL Server Database Engine
Versions
All supported SQL Server versions (2016 to 2025), Azure SQL Managed Instance
Last reviewed
24 October 2026

What it means

Error 7416 means the linked server has no login mapping that applies to you: neither one for your own login nor a default mapping for all logins, so SQL Server refuses before contacting the remote server.

When you use a linked server, SQL Server looks in sys.linked_logins for a row for your login, and if there is none, for the default row that covers every login (local_principal_id = 0). That row says whether to connect as yourself or as a named remote login. If neither row exists, there is nothing to connect with and 7416 is raised locally. The message does not name the linked server, so look at the statement that failed.

sp_addlinkedserver creates the default self-mapping for you, so 7416 usually means someone removed it on purpose (for example with sp_droplinkedsrvlogin and a NULL login) to allow only certain logins, and your login is not one of them. It is not a wrong password or a remote permission problem: those come back from the remote server as 18456 or as provider errors such as 7399 and 7303.

Common causes

  • The default mapping for all logins was removed, and mappings exist only for specific logins that do not include yours.
  • The linked server was scripted or recreated with sp_addlinkedsrvlogin calls for some logins only.
  • Your login reaches the linked server through a different identity than expected (for example a job owner, an EXECUTE AS context or a new Windows group login) that has no mapping.
  • The mapping for a login was dropped when that login was dropped and recreated on the local server.

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 logins are mapped for each linked server?

SELECT s.name AS linked_server,
       CASE WHEN l.local_principal_id = 0 THEN N'(all logins)' ELSE p.name END AS local_login,
       l.uses_self_credential, l.remote_name
FROM sys.servers AS s
LEFT JOIN sys.linked_logins AS l ON l.server_id = s.server_id
LEFT JOIN sys.server_principals AS p ON p.principal_id = l.local_principal_id
WHERE s.is_linked = 1
ORDER BY s.name, local_login;
What to look for

A linked server with no (all logins) row works only for the logins listed. A row with NULL in every mapping column means no mapping exists at all.

Which login is my session using?

SELECT SUSER_SNAME() AS current_login, ORIGINAL_LOGIN() AS original_login;
What to look for

The mapping is looked up for the current login. If it differs from the original login (impersonation), that is the identity that needs a mapping.

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.

Add a mapping for the login that needs the linked server

Changes permissions

Map the specific login, either to itself (@useself = 'True', which for Windows logins needs Kerberos delegation) or to a dedicated remote login that has only the rights the queries need.

Caution: Do not map logins to sa or another sysadmin login on the remote server: everyone who uses the mapping gets full control there.

EXEC master.dbo.sp_addlinkedsrvlogin
     @rmtsrvname = N'SALESSRV01', @useself = N'False',
     @locallogin = N'CONTOSO\ReportUser',
     @rmtuser = N'report_reader', @rmtpassword = N'<strong password>';

Restore the default self-mapping, if everyone may use it

Changes permissions

If the linked server was meant to be open to every login with their own credentials, recreate the default mapping that sp_addlinkedserver normally adds. Check with the owner first, because the restriction may be intended.

EXEC master.dbo.sp_addlinkedsrvlogin
     @rmtsrvname = N'SALESSRV01', @useself = N'True', @locallogin = NULL;

Run the remote work under a mapped identity

Client or network side

If only a service login is meant to use the linked server, move the remote call into a job step or procedure that runs as that login instead of mapping more users.

Examples

A linked server whose default mapping was removed

-- A throwaway linked server that points back at this instance
EXEC master.dbo.sp_addlinkedserver @server = N'cws_errlab_ls', @srvproduct = N'',
     @provider = N'MSOLEDBSQL', @datasrc = N'localhost';
-- Remove the default mapping for all logins
EXEC master.dbo.sp_droplinkedsrvlogin @rmtsrvname = N'cws_errlab_ls', @locallogin = NULL;
GO
SELECT * FROM OPENQUERY(cws_errlab_ls, 'SELECT 1 AS x');
GO
EXEC master.dbo.sp_dropserver @server = N'cws_errlab_ls', @droplogins = 'droplogins';
Result
Msg 7416, Level 16, State 1, Line 1
Access to the remote server is denied because no login-mapping exists.

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

How to prevent it

Decide per linked server who may use it and write that down as explicit sp_addlinkedsrvlogin calls in the server build script, including whether the default mapping exists. Review sys.linked_logins when logins are added or recreated, and when job owners or service accounts change.

Common questions

Why does the linked server work for the DBA but not for an application?

Mappings are per login. The DBA login probably has its own row in sys.linked_logins while the application login has none and there is no default mapping.

Is 7416 the same as a failed login on the remote server?

No. 7416 is raised locally before any connection is made. A wrong remote password or a missing remote login comes back from the remote server or the provider as a different error.

Learn more on CodeWithSQL

Official documentation

Last technically reviewed 24 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.