Skip to content

Latest commit

 

History

History
91 lines (55 loc) · 3.9 KB

File metadata and controls

91 lines (55 loc) · 3.9 KB
title Create a Job Category | Microsoft Docs
ms.custom
ms.date 06/13/2017
ms.prod sql-server-2014
ms.reviewer
ms.technology ssms
ms.topic conceptual
helpviewer_keywords
SQL Server Agent jobs, categories
jobs [SQL Server Agent], categories
categories [SQL Server Agent jobs]
ms.assetid e24a6d38-d231-4f64-ab89-2d1ef6f5792c
author stevestein
ms.author sstein
manager craigg

Create a Job Category

This topic describes how to create a job category in [!INCLUDEssCurrent] by using [!INCLUDEssManStudioFull], [!INCLUDEtsql] or [!INCLUDEssNoVersion] Management Objects.

[!INCLUDEssNoVersion] Agent provides built-in job categories that you can assign jobs to, or you can create a job category and assign jobs to it. Job categories help you organize your jobs for easy filtering and grouping. For example, you can organize all your database backup jobs in the Database Maintenance category. You can also create your own job categories.

Before You Begin

Limitations and Restrictions

Multiserver categories exist only on a master server. There is only one default job category available on a master server: [Uncategorized (Multi-Server)]. When a multiserver job is downloaded, its category is changed to Jobs From MSX at the target server.

Security

For detailed information, see Implement SQL Server Agent Security.

Using SQL Server Management Studio

To create a job category

  1. In Object Explorer, click the plus sign to expand the server where you want to create a job category.

  2. Click the plus sign to expand SQL Server Agent.

  3. Right-click the Jobs folder and select Manage Job Categories.

  4. In the Manage Job Categoriesserver_name dialog box, click Add.

  5. In the new dialog box, in the Name box, enter a name for the new job category.

  6. Select the Show all jobs check box. Select one or more jobs for the new category by checking the boxes corresponding to the jobs.

  7. Click OK.

  8. In the Manage Job Categoriesserver_name dialog box, click Refresh to ensure that the new job category is active. If everything looks as expected, close this dialog box.

For more information on these dialog boxes, see Job Categories: Manage Job Categories and Job Categories Properties and New Job Category.

Using Transact-SQL

To create a job category

  1. In Object Explorer, connect to an instance of [!INCLUDEssDE].

  2. On the Standard bar, click New Query.

  3. Copy and paste the following example into the query window and click Execute.

    -- creates a local job category named AdminJobs   
    USE msdb ;  
    GO  
    EXEC dbo.sp_add_category  
        @class=N'JOB',  
        @type=N'LOCAL',  
        @name=N'AdminJobs' ;  
    GO  
    

For more information, see sp_add_category (Transact-SQL).

Using SQL Server Management Objects

To create a job category

Call the JobCategory class by using a programming language that you choose, such as Visual Basic, Visual C#, or PowerShell. For example code, see Scheduling Automatic Administrative Tasks in SQL Server Agent.