Category Object
未來的 Microsoft SQL Server 版本將移除這項功能。請避免在新的開發工作中使用這項功能,並規劃修改目前使用這項功能的應用程式。
The Category object represents the attributes of a SQL Server Agent alert, job, or operator category.
備註
SQL Server Agent categories are optional attributes that group alerts, jobs, and operators. With the Category object, you can:
Create groupings for alerts, jobs, and operators.
Use the Name property value to view specific jobs when applying a JobFilter object.
The Name property of a Category object uses the Microsoft SQL Server data type sysname. For each type of SQL Server category, the category name must be unique.
The Type property applies only to categories used for SQL Server Agent jobs. When used with a job, the Type property value can be set. Setting it for SQL Server alert or operator categories results in an error.
To create a SQL Server job category
Create a Category object.
Set the Name property.
Set the Type property, optionally.
Add the Category object to the JobCategories collection of a connected JobServer object.
To create a SQL Server operator category
Create a Category object.
Set the Name property.
Add the Category object to the OperatorCategories collection of a connected JobServer object.