共用方式為


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 Agent 排程自動管理工作

自動化管理工作 (SQL Server Agent)

sp_delete_jobschedule (Transact-SQL)