Transact-SQL Reference

sp_helpgroup

Reports information about a role, or all roles, in the current database. This procedure is included for backward compatibility. Microsoft® SQL Server™ version 7.0 uses roles instead of groups. Use sp_helprole.

Syntax

sp_helpgroup [ [ @grpname = ] 'role' ]

Arguments

[@grpname =] 'role'

Is the name of a role. role must exist in the current database. role is sysname, with a default of NULL. If role is specified, information about the name of the role and the members of the role is returned; otherwise, information about all the roles in the current database is returned.

Return Code Values

0 (success) or 1 (failure)

Result Sets

role is not specified.

Column name Data type Description
Group_name sysname Name of the role in the current database.
Group_id smallint Role ID for the role in the current database.

role is specified.

Column name Data type Description
Group_name sysname Name of the role in the current database.
Group_id smallint Role ID for the role in the current database.
Users_in_group sysname Member of the role in the current database.
Userid smallint User ID for the member of the role.

Remarks

To view the permissions associated with the role, use sp_helprotect.

Permissions

Execute permissions default to the public role.

Examples
A. Return information about a single role

This example returns information about the hackers role.

EXEC sp_helpgroup 'hackers'
B. Return information about all roles

This example returns information about all roles in the current database.

EXEC sp_helpgroup

See Also

sp_helprotect

sp_helprole

sp_helpuser

System Stored Procedures