sp_srvrolepermission (Transact-SQL)sp_srvrolepermission (Transact-SQL)

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions)

显示固定服务器角色的权限。Displays the permissions of a fixed server role.


后续版本的 Microsoft SQL Server 将删除该功能。This feature will 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.

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


sp_srvrolepermission [ [ @srvrolename = ] 'role']  


[ @srvrolename = ] 'role' 为其返回权限的固定服务器角色的名称。[ @srvrolename = ] 'role' Is the name of the fixed server role for which permissions are returned. role 的值为 sysname,默认值为 NULL。role is sysname, with a default of NULL. 如果未指定角色,则返回所有固定服务器角色的权限。If no role is specified, the permissions for all fixed server roles are returned. 角色 可以具有以下值之一。role can have one of the following values.

Value 说明Description
sysadminsysadmin 系统管理员System administrators
securityadminsecurityadmin 安全管理员Security administrators
serveradminserveradmin 服务器管理员Server administrators
setupadminsetupadmin 安装程序管理员Setup administrators
processadminprocessadmin 进程管理员Process administrators
diskadmindiskadmin 磁盘管理员Disk administrators
dbcreatordbcreator 数据库创建者Database creators
bulkadminbulkadmin 可执行 BULK INSERT 语句Can execute BULK INSERT statements

返回代码值Return Code Values

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

结果集Result Sets

列名称Column name 数据类型Data type 说明Description
ServerRoleServerRole sysnamesysname 固定服务器角色的名称Name of a fixed server role
权限Permission sysnamesysname ServerRole 关联的权限Permission associated with ServerRole


列出的权限包括可以执行的 Transact-SQLTransact-SQL 语句和固定服务器角色成员可执行的其他特殊活动。The permissions listed include the Transact-SQLTransact-SQL statements that can be executed, and other special activities that can be performed by members of the fixed server role. 若要显示固定服务器角色的列表,请执行 sp_helpsrvroleTo display a list of the fixed server roles, execute sp_helpsrvrole.

Sysadmin 固定服务器角色具有其他所有固定服务器角色的权限。The sysadmin fixed server role has the permissions of all the other fixed server roles.


要求 公共 角色具有成员身份。Requires membership in the public role.


以下查询返回与 sysadmin 固定服务器角色关联的权限。The following query returns the permissions associated with the sysadmin fixed server role.

EXEC sp_srvrolepermission 'sysadmin';  

另请参阅See Also

安全存储过程 (Transact-SQL) Security Stored Procedures (Transact-SQL)
sp_addsrvrolemember (Transact-SQL) sp_addsrvrolemember (Transact-SQL)
sp_dropsrvrolemember (Transact-sql) sp_dropsrvrolemember (Transact-SQL)
sp_helpsrvrole (Transact-sql) sp_helpsrvrole (Transact-SQL)
系统存储过程 (Transact-SQL)System Stored Procedures (Transact-SQL)