Skip to content

Latest commit

 

History

History
82 lines (60 loc) · 2.7 KB

File metadata and controls

82 lines (60 loc) · 2.7 KB
title sp_helprole (Transact-SQL)
description sp_helprole returns information about the roles in the current database.
author markingmyname
ms.author maghan
ms.reviewer randolphwest
ms.date 06/23/2025
ms.service sql
ms.subservice system-objects
ms.topic reference
ms.custom
ignite-2025
f1_keywords
sp_helprole_TSQL
sp_helprole
helpviewer_keywords
sp_helprole
dev_langs
TSQL
monikerRange =azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric-sqldb

sp_helprole (Transact-SQL)

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance FabricSQLDB]

Returns information about the roles in the current database.

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

Syntax

sp_helprole [ [ @rolename = ] N'rolename' ]
[ ; ]

Arguments

[ @rolename = ] N'rolename'

The name of a role in the current database. @rolename is sysname, with a default of NULL. @rolename must exist in the current database. If @rolename isn't specified, information about all roles in the current database is returned.

Return code values

0 (success) or 1 (failure).

Result set

Column name Data type Description
RoleName sysname Name of the role in the current database.
RoleId smallint ID of RoleName.
IsAppRole int 0 = RoleName isn't an application role.
1 = RoleName is an application role.

Remarks

To view the permissions associated with the role, use sp_helprotect. To view the members of a database role, use sp_helprolemember.

Permissions

Requires membership in the public role.

Examples

The following query returns all the roles in the current database.

EXECUTE sp_helprole;

Related content