Export (0) Print
Expand All
Expand Minimize

sp_droprole (Transact-SQL)

Removes a database role from the current database.

ms186716.note(en-US,SQL.90).gifImportant:
In SQL Server 2005, sp_droprole is replaced by the DROP ROLE statement. sp_droprole is included only for compatibility with earlier versions of SQL Server and may not be supported in a future release.

Topic link icon Transact-SQL Syntax Conventions


sp_droprole [ @rolename= ] 'role'

[ @rolename = ] 'role'

Is the name of the database role to remove from the current database. role is a sysname, with no default. role must already exist in the current database.

0 (success) or 1 (failure)

Only database roles can be removed by using sp_droprole.

A database role with existing members cannot be removed. All members of a database role must be removed before the database 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 securables. Before dropping an application role that owns securables, you must first transfer ownership of the securables, or drop them. Use ALTER AUTHORIZATION to change the owner of objects that must not be removed.

sp_droprole cannot be executed within a user-defined transaction.

Requires CONTROL permission on the role.

The following example removes the application role Sales.

EXEC sp_droprole 'Sales';
GO

Community Additions

ADD
Show:
© 2014 Microsoft