다음을 통해 공유


JobCategories Collection

Microsoft SQL Server의 이후 버전에서는 이 기능이 제거됩니다. 새 개발 작업에서는 이 기능을 사용하지 않도록 하고, 현재 이 기능을 사용하는 응용 프로그램은 수정하십시오.

The JobCategories collection contains Category objects that expose a SQL Server Agent job-organizing method.

현재 개체를 보여 주는 SQL-DMO 개체 모델

주의

For SQL Server Agent, categories offer a mixed system and user-defined method for grouping alerts, operators, and jobs. When using SQL Distributed Management Objects (SQL-DMO) to administer jobs, a job category can be used to filter job lists that streamline administrative tasks, such as job execution.

With the JobCategories collection, you can:

  • Create a new category for SQL Server Agent jobs.

  • Remove a SQL Server Agent job category.

To remove a job category

  • Use the Remove method of the JobCategories collection, as in:

    oJobServer.JobCategories.Remove("Northwind_Backup")
    

    [!참고]

    When using the Remove method of the JobCategories collection, existing SQL Server Agent jobs are reclassified as necessary. If a locally-defined job exhibits the removed category, it is assigned the system-defined category [Uncategorized (Local)] when the existing category is removed. If a job targets multiple target servers, it is assigned the system-defined category [Uncategorized (Multi-Server)] when the existing category is removed.

When using the Item or Remove method, the JobCategories collection supports member identification using either name or ordinal reference syntax. For example:

Set oCategory = oJobServer.JobCategories("Northwind_Backup")

Or

Set oCategory = oJobServer.JobCategories(7)