sp_help_category (Transact-SQL)

 

Updated: August 9, 2016

THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Provides information about the specified classes of jobs, alerts, or operators.

Topic link icon Transact-SQL Syntax Conventions

  
sp_help_category [ [ @class = ] 'class' ]   
     [ , [ @type = ] 'type' ]   
     [ , [ @name = ] 'name' ]   
     [ , [ @suffix = ] suffix ]   

[ @class=] 'class'
The class about which information is requested. class is varchar(8), with a default value of JOB. class can be one of these values.

ValueDescription
JOBProvides information about a job category.
ALERTProvides information about an alert category.
OPERATORProvides information about an operator category.

[ @type= ] 'type'
The type of category for which information is requested. type is varchar(12), with a default of NULL, and can be one of these values.

ValueDescription
LOCALLocal job category.
MULTI -SERVERMultiserver job category.
NONECategory for a class other than JOB.

[ @name= ] 'name'
The name of the category for which information is requested. name is sysname, with a default of NULL.

[ @suffix= ] suffix
Specifies whether the category_type column in the result set is an ID or a name. suffix is bit, with a default of 0. 1 shows the category_type as a name, and 0 shows it as an ID.

0 (success) or 1 (failure)

When @suffix is 0, sp_help_category returns the following result set:

Column nameData typeDescription
category_idintCategory ID
category_typetinyintType of category:

 1 = Local

 2 = Multiserver

 3 = None
namesysnameCategory name

When @suffix is 1, sp_help_category returns the following result set:

Column nameData typeDescription
category_idintCategory ID
category_typesysnameType of category. One of LOCAL, MULTI-SERVER, or NONE
namesysnameCategory 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.

By default, members of the sysadmin fixed server role can execute this stored procedure. Other users must be granted one of the following SQL Server 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.

A. Returning local job information

The following example returns information about jobs that are administered locally.

USE msdb ;  
GO  
  
EXEC dbo.sp_help_category  
    @type = N'LOCAL' ;  
GO  

B. Returning alert information

The following example returns information about the Replication alert category.

USE msdb ;  
GO  
  
EXEC dbo.sp_help_category  
    @class = N'ALERT',  
    @name = N'Replication' ;  
GO  

sp_add_category (Transact-SQL)
sp_delete_category (Transact-SQL)
sp_update_category (Transact-SQL)
System Stored Procedures (Transact-SQL)

Community Additions

ADD
Show: