Removes a remote login mapped to a local login used to execute remote stored procedures against the local server running Microsoft® SQL Server™.
sp_dropremotelogin [@remoteserver =] 'remoteserver'
[,[@loginame =] 'login']
[,[@remotename =] 'remote_name']
0 (success) or 1 (failure)
If only remoteserver is specified, all remote logins for that remote server are removed from the local server. If login is additionally specified, all remote logins from remoteserver mapped to that specific local login are removed from the local server. If remote_name is also specified, only the remote login for that remote user from remoteserver is removed from the local server.
To add local server users, use sp_addlogin. To remove local server users, use sp_droplogin.
Remote logins are only required when using earlier versions of SQL Server. SQL Server version 7.0 uses linked server logins instead. Use sp_addlinkedsrvlogin and sp_droplinkedsrvlogin to add and remove linked server logins.
sp_dropremotelogin cannot be executed within a user-defined transaction.
Only members of the sysadmin or securityadmin fixed server roles can execute sp_dropremotelogin.
This example removes the entry for the remote server ACCOUNTS, thereby removing all mappings between logins on the local server and remote logins on the remote server.
EXEC sp_dropremotelogin 'ACCOUNTS'
This example removes the entry for mapping remote logins from the remote server ACCOUNTS to the local login Albert.
EXEC sp_dropremotelogin 'ACCOUNTS', 'Albert'
This example removes the login for the remote login Chris on the remote server ACCOUNTS that was mapped to the local login salesmgr.
EXEC sp_dropremotelogin 'ACCOUNTS', 'salesmgr', 'Chris'
sp_addlogin | sp_droplinkedsrvlogin |
sp_addlinkedsrvlogin | sp_droplogin |
sp_addremotelogin | sp_helpremotelogin |
sp_addserver | System Stored Procedures |