Removes a Microsoft® SQL Server™ role from the current database.
sp_droprole [@rolename =] 'role'
0 (success) or 1 (failure)
Column name | Data type | Description |
---|---|---|
Name | sysname | The name of the existing member of the role |
Only standard user roles can be removed using sp_droprole. To remove an application role, use sp_dropapprole.
A role with existing members cannot be removed. All members of the role must first be removed from the role before the role can be removed. To remove users from a role, use sp_droprolemember. If any users are still members of the role, sp_droprole displays those members.
Fixed roles and the public role cannot be removed.
A role cannot be removed if it owns any objects. Either remove the objects before removing the role, or use sp_changeobjectowner to change the owner of any objects that must not be removed.
sp_droprole cannot be executed from within a user-defined transaction.
Only members of the db_owner or db_securityadmin fixed database roles can execute sp_droprole.
This example removes the SQL Server role Sales.
EXEC sp_droprole 'Sales'
sp_addrole | System Stored Procedures |
sp_dropapprole |