Share via


JobSchedule 類別

The JobSchedule class represents a SQL Server Agent job schedule.

命名空間:  Microsoft.SqlServer.Management.Smo.Agent
組件:  Microsoft.SqlServer.Smo (在 Microsoft.SqlServer.Smo.dll 中)

語法

'宣告
<SfcElementTypeAttribute("Schedule")> _
Public NotInheritable Class JobSchedule _
    Inherits ScheduleBase _
    Implements IAlterable, ICreatable, IDroppable, IRenamable,  _
    IScriptable
'用途
Dim instance As JobSchedule
[SfcElementTypeAttribute("Schedule")]
public sealed class JobSchedule : ScheduleBase, 
    IAlterable, ICreatable, IDroppable, IRenamable, IScriptable
[SfcElementTypeAttribute(L"Schedule")]
public ref class JobSchedule sealed : public ScheduleBase, 
    IAlterable, ICreatable, IDroppable, IRenamable, IScriptable
[<SealedAttribute>]
[<SfcElementTypeAttribute("Schedule")>]
type JobSchedule =  
    class
        inherit ScheduleBase
        interface IAlterable
        interface ICreatable
        interface IDroppable
        interface IRenamable
        interface IScriptable
    end
public final class JobSchedule extends ScheduleBase implements IAlterable, ICreatable, IDroppable, IRenamable, IScriptable

備註

SQL Server Agent jobs can be scheduled to run by using SQL Server Agent. Jobs can be scheduled to run when SQL Server Agent is enabled, but jobs are not required to be scheduled. They can be run on demand by a sufficiently privileged user. Jobs can have more than one active schedule. SQL Server Agent evaluates all schedules to determine when to run the job. By using the JobSchedule object, you can do the following:

  • Create a schedule for a SQL Server Agent job.

  • Remove a schedule from an existing SQL Server Agent job.

  • Manage job schedules either by enabling a schedule or adjusting run times or frequencies.

To get or set JobSchedule object properties, users must be a member of the SQLAgentUserRole database role on the MSDB database, or be the owner of the job, or be a member of the sysadmin fixed server role.

To create a job schedule, users must be a member of the SQLAgentUserRole database role on the MSDB database, or be a member of the sysadmin fixed server role.

To drop a job schedule, users must be a member of the SQLAgentUserRole database role on the MSDB database, or be a member of the sysadmin fixed server role.

Thread Safety

這種類型的任何公用靜態 (在 Microsoft Visual Basic 中則為 Shared) 成員都可用於多執行緒作業。並不是所有的執行個體成員都保證可以用於所有的執行緒。

執行緒安全性

這個類型的任何公用static (在 Visual Basic 中為 Shared) 成員都是安全執行緒。不保證任何執行個體成員都可以是安全執行緒。