Freigeben über


Job.RemoveAllJobSchedules-Methode (Boolean)

Removes all unused schedules from the job.

Namespace:  Microsoft.SqlServer.Management.Smo.Agent
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

Syntax

'Declaration
Public Sub RemoveAllJobSchedules ( _
    keepUnusedSchedules As Boolean _
)
'Usage
Dim instance As Job 
Dim keepUnusedSchedules As Boolean

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

Parameter

  • keepUnusedSchedules
    Typ: System.Boolean
    A Boolean value that specifies whether to keep the unused schedules from the removed job.If True, the shared schedules are kept.If False, the shared schedules are not kept.

Hinweise

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.

Beispiele

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

C#

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

PowerShell

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

Siehe auch

Verweis

Job Klasse

RemoveAllJobSchedules-Überladung

Microsoft.SqlServer.Management.Smo.Agent-Namespace

Andere Ressourcen

Planen von automatischen, administrativen Tasks im SQL Server-Agent

Automatisierte Administrationstasks (SQL Server-Agent)

sp_delete_jobschedule (Transact-SQL)