Skip to content

Latest commit

 

History

History
109 lines (77 loc) · 3.53 KB

sp-helpsrvrole-transact-sql.md

File metadata and controls

109 lines (77 loc) · 3.53 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_helpsrvrole (Transact-SQL)
sp_helpsrvrole Returns a list of the SQL Server fixed server roles.
markingmyname
maghan
randolphwest
05/15/2024
sql
system-objects
reference
sp_helpsrvrole_TSQL
sp_helpsrvrole
sp_helpsrvrole
TSQL

sp_helpsrvrole (Transact-SQL)

[!INCLUDE SQL Server]

Returns a list of the [!INCLUDE ssNoVersion] fixed server roles.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

sp_helpsrvrole [ [ @srvrolename = ] N'srvrolename' ]
[ ; ]

Arguments

[ @srvrolename = ] N'srvrolename'

The name of the fixed server role. @srvrolename is sysname, with a default of NULL, and can be one of the following values.

Fixed server role Description
sysadmin System administrators
securityadmin Security administrators
serveradmin Server administrators
setupadmin Setup administrators
processadmin Process administrators
diskadmin Disk administrators
dbcreator Database creators
bulkadmin Can execute BULK INSERT statements

Return code values

0 (success) or 1 (failure).

Result set

Column name Data type Description
ServerRole sysname Name of the server role
Description sysname Description of ServerRole

Remarks

Fixed server roles are defined at the server level and have permissions to perform specific server-level administrative activities. Fixed server roles can't be added, removed, or changed.

To add or removed members from server roles, see ALTER SERVER ROLE.

All logins are a member of public. sp_helpsrvrole doesn't recognize the public role because, internally, [!INCLUDE ssNoVersion] doesn't implement public as a role.

sp_helpsrvrole doesn't take a user-defined server role as an argument. To list the user-defined server roles, see the examples in ALTER SERVER ROLE.

Permissions

Requires membership in the public role.

Examples

A. List the fixed server roles

The following query returns the list of fixed server roles.

EXEC sp_helpsrvrole;

B. List fixed and user-defined server roles

The following query returns a list of both fixed and user-defined server roles.

SELECT * FROM sys.server_principals WHERE type = 'R';

C. Return a description of a fixed server role

The following query returns the name and description of the diskadmin fixed server roles.

EXEC sp_helpsrvrole 'diskadmin';

Related content