| title | sp_helprole (Transact-SQL) | Microsoft Docs | ||
|---|---|---|---|
| ms.custom | |||
| ms.date | 03/14/2017 | ||
| ms.prod | sql | ||
| ms.prod_service | database-engine, sql-database | ||
| ms.reviewer | |||
| ms.technology | system-objects | ||
| ms.topic | language-reference | ||
| f1_keywords |
|
||
| dev_langs |
|
||
| helpviewer_keywords |
|
||
| ms.assetid | b023103f-ccf3-44e2-b418-4be9bdd49f4a | ||
| author | stevestein | ||
| ms.author | sstein | ||
| monikerRange | =azuresqldb-current||>=sql-server-2016||=sqlallproducts-allversions||>=sql-server-linux-2017||=azuresqldb-mi-current |
[!INCLUDEtsql-appliesto-ss2008-asdb-xxxx-xxx-md]
Returns information about the roles in the current database.
Transact-SQL Syntax Conventions
sp_helprole [ [ @rolename = ] 'role' ]
[ @rolename = ] 'role'
Is the name of a role in the current database. role is sysname, with a default of NULL. role must exist in the current database. If role is not specified, information about all roles in the current database is returned.
0 (success) or 1 (failure)
| Column name | Data type | Description |
|---|---|---|
| RoleName | sysname | Name of the role in the current database. |
| RoleId | smallint | ID of RoleName. |
| IsAppRole | int | 0 = RoleName is not an application role. 1 = RoleName is an application role. |
To view the permissions associated with the role, use sp_helprotect. To view the members of a database role, use sp_helprolemember.
Requires membership in the public role.
The following query returns all the roles in the current database.
EXEC sp_helprole
Security Stored Procedures (Transact-SQL)
Server-Level Roles
Database-Level Roles
sp_addapprole (Transact-SQL)
sp_addrole (Transact-SQL)
sp_droprole (Transact-SQL)
sp_helprolemember (Transact-SQL)
sp_helpsrvrolemember (Transact-SQL)
System Stored Procedures (Transact-SQL)