Create a Job Category
This topic describes how to create a job category in SQL Server 2016 by using SQL Server Management Studio, Transact-SQL or SQL Server Management Objects.
SQL Server 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.
In This Topic
Before you begin:
To create a job category, using:
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.
For detailed information, see Implement SQL Server Agent Security.
In Object Explorer, click the plus sign to expand the server where you want to create a job category.
Click the plus sign to expand SQL Server Agent.
Right-click the Jobs folder and select Manage Job Categories.
In the Manage Job Categoriesserver_name dialog box, click Add.
In the new dialog box, in the Name box, enter a name for the new job category.
Select the Show all jobs check box. Select one or more jobs for the new category by checking the boxes corresponding to the jobs.
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.
In Object Explorer, connect to an instance of Database Engine.
On the Standard bar, click New Query.
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).
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.