Removes a security account from a Microsoft® SQL Server™ role in the current database.
sp_droprolemember [@rolename =] 'role',
[@membername =] 'security_account'
0 (success) or 1 (failure)
sp_droprolemember removes a role member by deleting a row from the sysmembers table. When removing a member from a role, the permissions applied to the role are no longer applied to the former member of the role.
sp_droprolemember cannot be used to remove a Windows NT user from a Windows NT group; this must be done in the Windows NT security system. To remove a user from a fixed server role, use sp_dropsrvrolemember. Users cannot be removed from the public role, and dbo cannot be removed from any role.
Use sp_helpuser to see the members of a SQL Server role, and use sp_addrolemember to add a member to a role.
sp_droprolemember cannot be executed from within a user-defined transaction.
Only members of the db_owner or db_securityadmin fixed database roles can execute sp_droprolemember. Only a member of the db_owner fixed database role can remove users from a fixed database role.
This example removes the user JonB from the role Sales.
EXEC sp_droprolemember 'Sales', 'Jonb'
sp_addrolemember | sp_helpuser |
sp_droprole | System Stored Procedures |
sp_dropsrvrolemember |