Assign a Job to a Job Category
This topic describes how to assign Microsoft SQL Server Agent jobs to job categories in SQL Server 2012 by using SQL Server Management Studio, Transact-SQL or SQL Server Management Objects.
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 assign jobs to built-in job categories, or you can create a user-defined job category and then assign jobs to that.
In This Topic
Before you begin:
Security
To assign a job to a job category, using:
SQL Server Management Studio
Transact-SQL
SQL Server Management Objects
Before You Begin
Security
For detailed information, see Implement SQL Server Agent Security.
[Top]
Using SQL Server Management Studio
To assign a job to a job category
In Object Explorer, click the plus sign to expand the server where you want to assign a job to a job category.
Click the plus sign to expand SQL Server Agent.
Click the plus sign to expand the Jobs folder.
Right-click the job you want to edit and select Properties.
In the Job Properties - job_name dialog box, in the Category list, select the job category you want to assign to the job.
Click OK.
[Top]
Using Transact-SQL
To assign a job to a job category
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.
-- adding a new job category to the "NightlyBackups" job USE msdb ; GO EXEC dbo.sp_update_job @job_name = N'NightlyBackups', @category_name = N'[Uncategorized (Local)]'; GO
For more information, see sp_update_job (Transact-SQL).
[Top]
Using SQL Server Management Objects
To assign a job to a job category
Use the JobCategory class by using a programming language that you choose, such as Visual Basic, Visual C#, or PowerShell. For more information, see SQL Server Management Objects (SMO).
[Top]