Export (0) Print
Expand All
Expand Minimize

sp_helpgroup (Transact-SQL)

SQL Server 2005

Reports information about a role, or all roles, in the current database.

ms188925.note(en-US,SQL.90).gifImportant:
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.

Topic link icon 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.

A. Returning information about a single role

The following query returns information about the SammamishShippers role.

EXEC sp_helpgroup 'SammamishShippers'

B. Returning information about all roles

The following example returns information about all roles in the current database.

EXEC sp_helpgroup

Community Additions

ADD
Show:
© 2014 Microsoft