Applies To: SQL Server 2014, SQL Server 2016 Preview
Removes a remote login mapped to a local login used to execute remote stored procedures against the local server running SQL Server.
This feature will be removed in the next version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible. Use linked servers and linked-server stored procedures instead.
Applies to: SQL Server (SQL Server 2008 through current version).
- [ @remoteserver = ] 'remoteserver'
Is the name of the remote server mapped to the remote login that is to be removed. remoteserver is sysname, with no default. remoteserver must already exist.
- [ @loginame = ] 'login'
Is the optional login name on the local server that is associated with the remote server. login is sysname, with a default of NULL. login must already exist if specified.
- [ @remotename = ] 'remote_name'
Is the optional name of the remote login that is mapped to login when logging in from the remote server. remote_name is sysname, with a default of NULL.
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 also 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 required only when you use earlier versions of SQL Server. SQL Server version 7.0 and later versions use 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.
Requires membership in the sysadmin or securityadmin fixed server roles.
The following example removes the entry for the remote server ACCOUNTS, and, therefore, removes all mappings between logins on the local server and remote logins on the remote server.
EXEC sp_dropremotelogin 'ACCOUNTS';
The following example removes the entry for mapping remote logins from the remote server ACCOUNTS to the local login Albert.
EXEC sp_dropremotelogin 'ACCOUNTS', 'Albert';