Change the Membership of a Job Category

This topic describes how to change the membership of the job category 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. You can create your own job categories. You can also change Microsoft SQL Server Agent jobs membership in job categories.

In This Topic

  • Before you begin:

    Security

  • To change the membership of 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 change the membership of a job category

  1. In Object Explorer, click the plus sign to expand the server where you want to edit 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 Categories server_name dialog box, select the job category that you want to edit, and then click View Jobs.

  5. Select the Show all jobs check box.

  6. To add a job to the category, in the main grid, select the check box in the Select column corresponding to the job. To remove a job from the category, clear the box. When finished, click OK.

  7. Close the Manage Job Categories server_name dialog box.

Arrow icon used with Back to Top link [Top]

Using Transact-SQL

To change the membership of a job category

  1. In Object Explorer, connect to an instance of Database Engine.

  2. On the Standard bar, click New Query.

  3. 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).

Arrow icon used with Back to Top link [Top]

Using SQL Server Management Objects

To change the membership of 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).

Arrow icon used with Back to Top link [Top]