Skip to content

Latest commit

 

History

History
89 lines (63 loc) · 2.19 KB

sp-delete-category-transact-sql.md

File metadata and controls

89 lines (63 loc) · 2.19 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_delete_category (Transact-SQL)
Removes the specified category of jobs, alerts, or operators from the current server.
markingmyname
maghan
randolphwest
01/23/2024
sql
system-objects
reference
sp_delete_category_TSQL
sp_delete_category
sp_delete_category
TSQL

sp_delete_category (Transact-SQL)

[!INCLUDE SQL Server]

Removes the specified category of jobs, alerts, or operators from the current server.

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

Syntax

sp_delete_category
    [ @class = ] 'class'
    , [ @name = ] N'name'
[ ; ]

Arguments

[ @class = ] 'class'

The class of the category. @class is varchar(8), with no default, and must be one of these values.

Value Description
JOB Deletes a job category.
ALERT Deletes an alert category.
OPERATOR Deletes an operator category.

[ @name = ] N'name'

The name of the category to be removed. @name is sysname, with no default.

Return code values

0 (success) or 1 (failure).

Result set

None.

Remarks

sp_delete_category must be run from the msdb database.

Deleting a category recategorizes any jobs, alerts, or operators in that category to the default category for the class.

Permissions

[!INCLUDE msdb-execute-permissions]

Examples

The following example deletes the job category named AdminJobs.

USE msdb;
GO

EXEC dbo.sp_delete_category
    @name = N'AdminJobs',
    @class = N'JOB';
GO

Related content