Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Reports information about a role, or all roles, in the current database.
Important
sp_helpgroup provides compatibility with earlier versions of SQL Server. This feature will be removed in the next version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use the sys.database_principals catalog view instead.
Transact-SQL Syntax Conventions
sp_helpgroup [ [ @grpname = ] 'role' ]
- [ @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.
0 (success) or 1 (failure)
If role is not specified, the following information will be returned for all roles.
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. |
If role is specified, the following information will be returned.
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. |
To view the permissions associated with a role, use sp_helprotect.
Requires membership in the public role.
The following query returns information about the SammamishShippers
role.
EXEC sp_helpgroup 'SammamishShippers'
The following example returns information about all roles in the current database.
EXEC sp_helpgroup
Database Engine Stored Procedures (Transact-SQL)
sys.database_principals (Transact-SQL)
sp_helprotect (Transact-SQL)
sp_helprole (Transact-SQL)
sp_helpuser (Transact-SQL)
System Stored Procedures (Transact-SQL)