| title | sp_help_category (Transact-SQL) | ||
|---|---|---|---|
| description | Provides information about the specified classes of jobs, alerts, or operators. | ||
| author | markingmyname | ||
| ms.author | maghan | ||
| ms.reviewer | randolphwest | ||
| ms.date | 06/23/2025 | ||
| ms.service | sql | ||
| ms.subservice | system-objects | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
[!INCLUDE SQL Server]
Provides information about the specified classes of jobs, alerts, or operators.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_help_category
[ [ @class = ] 'class' ]
[ , [ @type = ] 'type' ]
[ , [ @name = ] N'name' ]
[ , [ @suffix = ] suffix ]
[ ; ]
Specifies the class about which information is requested. @class is varchar(8), and can be one of these values.
| Value | Description |
|---|---|
JOB (default) |
Provides information about a job category. |
ALERT |
Provides information about an alert category. |
OPERATOR |
Provides information about an operator category. |
The type of category for which information is requested. @type is varchar(12), and can be one of these values.
| Value | Description |
|---|---|
LOCAL |
Local job category. |
MULTI-SERVER |
Multiserver job category. |
NONE |
Category for a class other than JOB. |
The name of the category for which information is requested. @name is sysname, with a default of NULL.
Specifies whether the category_type column in the result set is an ID or a name. @suffix is bit, with a default of 0.
1shows thecategory_typeas a name.0shows thecategory_typeas an ID.
0 (success) or 1 (failure).
When @suffix is 0, sp_help_category returns the following result set:
| Column name | Data type | Description |
|---|---|---|
category_id |
int | Category ID |
category_type |
tinyint | Type of category:1 = Local2 = Multiserver3 = None |
name |
sysname | Category name |
When @suffix is 1, sp_help_category returns the following result set:
| Column name | Data type | Description |
|---|---|---|
category_id |
int | Category ID |
category_type |
sysname | Type of category. One of LOCAL, MULTI-SERVER, or NONE |
name |
sysname | Category name |
sp_help_category must be run from the msdb database.
If no parameters are specified, the result set provides information about all of the job categories.
[!INCLUDE msdb-execute-permissions]
Other users must be granted one of the following [!INCLUDE ssNoVersion] Agent fixed database roles in the msdb database:
- SQLAgentUserRole
- SQLAgentReaderRole
- SQLAgentOperatorRole
For details about the permissions of these roles, see SQL Server Agent Fixed Database Roles.
The following example returns information about jobs that are administered locally.
USE msdb;
GO
EXECUTE dbo.sp_help_category @type = N'LOCAL';
GOThe following example returns information about the Replication alert category.
USE msdb;
GO
EXECUTE dbo.sp_help_category
@class = N'ALERT',
@name = N'Replication';
GO