sp_dropapprole (Transact-SQL)sp_dropapprole (Transact-SQL)

适用对象:是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库 APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

从当前数据库删除应用程序角色。Removes an application role from the current database.

重要

此功能处于维护模式并且可能会在 Microsoft SQL Server 将来的版本中被删除。This feature is in maintenance mode and may be removed in a future version of Microsoft SQL Server. 请避免在新的开发工作中使用该功能,并着手修改当前还在使用该功能的应用程序。Avoid using this feature in new development work, and plan to modify applications that currently use this feature.请改用DROP APPLICATION ROLEUse DROP APPLICATION ROLE instead.

主题链接图标 Transact-SQL 语法约定Topic link icon Transact-SQL Syntax Conventions

语法Syntax

sp_dropapprole [@rolename = ] 'role'  

参数Arguments

[ @rolename = ] 'role'要删除的应用程序角色。[ @rolename = ] 'role' Is the application role to remove. rolesysname,无默认值。role is a sysname, with no default. 角色必须存在于当前数据库中。role must exist in the current database.

返回代码值Return Code Values

0(成功)或 1(失败)0 (success) or 1 (failure)

备注Remarks

sp_dropapprole只能用于删除应用程序角色。sp_dropapprole can only be used to remove application roles. 如果一个角色拥有任何安全对象,则不能删除此角色。If a role owns any securables, the role cannot be dropped. 在删除拥有安全对象的应用程序角色之前,必须首先移交安全对象的所有权或将其删除。Before dropping an application role that owns securables, you must first transfer ownership of the securables, or drop them.

不能在用户定义的事务中执行sp_dropapprolesp_dropapprole cannot be executed within a user-defined transaction.

权限Permissions

需要对数据库具有 ALTER ANY APPLICATION ROLE 权限。Requires ALTER ANY APPLICATION ROLE permission on the database.

示例Examples

以下示例将从当前数据库中删除 SalesApp 应用程序角色。The following example removes the SalesApp application role from the current database.

EXEC sp_dropapprole 'SalesApp';  

另请参阅See Also

安全存储过程 (Transact-sql) Security Stored Procedures (Transact-SQL)
sp_addapprole (Transact-sql) sp_addapprole (Transact-SQL)
DROP APPLICATION ROLE (Transact-SQL) DROP APPLICATION ROLE (Transact-SQL)
sp_changeobjectowner (Transact-sql) sp_changeobjectowner (Transact-SQL)
sp_setapprole (Transact-SQL) sp_setapprole (Transact-SQL)
系统存储过程 (Transact-SQL)System Stored Procedures (Transact-SQL)