Condividi tramite


Metodo Job.RemoveAllJobSchedules

Removes all shared and unshared schedules from the job.

Spazio dei nomi  Microsoft.SqlServer.Management.Smo.Agent
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

Sintassi

'Dichiarazione
Public Sub RemoveAllJobSchedules
'Utilizzo
Dim instance As Job

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

Osservazioni

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.

Esempi

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()

Vedere anche

Riferimento

Job Classe

Overload RemoveAllJobSchedules

Spazio dei nomi Microsoft.SqlServer.Management.Smo.Agent

Altre risorse

Pianificazione delle attività amministrative automatiche in SQL Server Agent

Automatizzazione delle attività amministrative (SQL Server Agent)

sp_delete_jobschedule (Transact-SQL)