sp_helpsrvrole (Transact-SQL)

Returns a list of the SQL Server fixed server roles.

Topic link iconTransact-SQL Syntax Conventions

Syntax

sp_helpsrvrole [ [ @srvrolename= ] 'role' ]

Arguments

  • [ **@srvrolename=** ] 'role'
    Is the name of the fixed server role. role is sysname, with a default of NULL. role 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 Sets

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 cannot be added, removed, or changed.

The following table shows stored procedures that can be used to modify server roles.

Stored procedure

Action

sp_addsrvrolemember

Adds a login account to a fixed server role.

sp_helpsrvrolemember

Displays a list of the members of a fixed server role.

sp_dropsrvrolemember

Removes a member of a server role.

Permissions

Requires membership in the public role.

Examples

The following query returns the list of available fixed server roles.

EXEC sp_helpsrvrole