sp_dropapprole

Transact-SQL Reference

Transact-SQL Reference

sp_dropapprole

Removes an application role from the current database.

Syntax

sp_dropapprole [@rolename =] 'role'

Arguments

[@rolename =] 'role'

Is the application role to remove. role is sysname, with no default. role must exist in the current database.

Return Code Values

0 (success) or 1 (failure)

Remarks

sp_dropapprole can only be used to remove application roles. Use sp_droprole to remove a standard Microsoft® SQL Server™ role. An application role cannot be removed if it owns any objects. Either remove the objects before removing the application role, or use sp_changeobjectowner to change the owner of any objects that must not be removed.

sp_dropapprole cannot be executed within a user-defined transaction.

Permissions

Only members of the sysadmin fixed server role, the db_securityadmin and db_owner fixed database roles can execute sp_dropapprole.

Examples

This example removes the SalesApp application role from the current database.

EXEC sp_dropapprole 'SalesApp'

See Also

sp_addapprole

sp_changeobjectowner

sp_setapprole

System Stored Procedures