Removes a security account from the current database.
sp_revokedbaccess [@name_in_db =] 'name'
0 (success) or 1 (failure)
When the account is removed, the permissions and aliases that depend on the account are automatically removed.
You can only remove accounts in the current database using sp_revokedbaccess. To add an account in the database, use sp_grantdbaccess. To remove a SQL Server role, use sp_droprole. When removing an account that owns objects in the current database, you must either remove the object, or change the owner of the object using sp_changeobjectowner, before executing sp_revokedbaccess.
The sp_revokedbaccess stored procedure cannot remove:
sp_revokedbaccess cannot be executed from within a user-defined transaction.
Only members of the db_accessadmin or db_owner fixed database roles can execute sp_revokedbaccess.
This example removes the account Corporate\GeorgeW from the current database.
EXEC sp_revokedbaccess 'Corporate\GeorgeW'
sp_grantdbaccess | sp_droprole |
sp_changeobjectowner | System Stored Procedures |