Share via


Job.RemoveAllJobSchedules 方法

Removes all shared and unshared schedules from the job.

命名空间:  Microsoft.SqlServer.Management.Smo.Agent
程序集:  Microsoft.SqlServer.Smo(在 Microsoft.SqlServer.Smo.dll 中)

语法

声明
Public Sub RemoveAllJobSchedules
用法
Dim instance As Job

instance.RemoveAllJobSchedules()
public void RemoveAllJobSchedules()
public:
void RemoveAllJobSchedules()
member RemoveAllJobSchedules : unit -> unit
public function RemoveAllJobSchedules()

注释

On successful execution, the JobSchedules collection property of the Job object is emptied. To reschedule the referenced job, create JobSchedule objects and add them to the JobSchedulescollection property of the Job object.

示例

The following code example deletes all schedules from the "Test Job" job.

C#

Server srv = new Server("(local)");
Job jb = srv.JobServer.Jobs["Test Job"];
jb.RemoveAllJobSchedules();

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$jb = $srv.JobServer.Jobs["Test Job"]
$jb.RemoveAllJobSchedules()

请参阅

参考

Job 类

RemoveAllJobSchedules 重载

Microsoft.SqlServer.Management.Smo.Agent 命名空间

其他资源

在 SQL Server 代理中计划自动管理任务

自动执行管理任务(SQL Server 代理)

sp_delete_jobschedule (Transact-SQL)