다음을 통해 공유


Jobs Collection

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

The Jobs collection contains Job objects that reference all SQL Server Agent jobs defined on an instance of Microsoft SQL Server.

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

Properties

Count Property

 

Methods

Add Method

Refresh Method

Item Method

Remove Method (Collections)

Script Method

 

주의

With the Jobs collection, you can:

  • Create a SQL Server Agent job.
  • Remove a SQL Server Agent job.
  • Generate Transact-SQL scripts used as part of job administration strategy for an instance of SQL Server.

For more information about creating a SQL Server Agent job, see Job Object.

To remove a SQL Server Agent job

  1. Use the Remove method of the Jobs collection, as in:

    oJobServer.Jobs.Remove("Northwind_Backup_Diff")
    

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

Set oJob = oJobServer.Jobs("Northwind_Backup_Log")

Or

Set oJob = oJobServer.Jobs(22)

[!참고] Creating or removing SQL Server Agent jobs by using the Jobs collection requires appropriate privilege. The SQL Server login used for SQLServer object connection must be a member of the fixed role public in the system database msdb. With public membership, the connection may create jobs and schedule, execute, and remove jobs belonging to the connected login. Members of the db_owner role in msdb, or members of a role with greater privilege, can modify or delete any SQL Server Agent job.