Applies To: SQL Server 2014, SQL Server 2016 Preview
Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).
Removes a database user from the current database.
This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use DROP USER instead.
Applies to: SQL Server (SQL Server 2008 through current version).
When the database user is removed, the permissions and aliases that depend on the user are also removed.
sp_revokedbaccess can remove only database users from the current database. Before removing a database user that owns objects in the current database, you must either transfer ownership of the objects or drop them from the database. For more information, see ALTER AUTHORIZATION (Transact-SQL).
sp_revokedbaccess cannot be executed within a user-defined transaction.
The following example removes the database user mapped to Edmonds\LolanSo from the current database.
EXEC sp_revokedbaccess 'Edmonds\LolanSo'; GO