Метод Job.Drop (Boolean)
Removes an existing job.
Пространство имен: Microsoft.SqlServer.Management.Smo.Agent
Сборка: Microsoft.SqlServer.Smo (в Microsoft.SqlServer.Smo.dll)
Синтаксис
'Декларация
Public Sub Drop ( _
keepUnusedSchedules As Boolean _
)
'Применение
Dim instance As Job
Dim keepUnusedSchedules As Boolean
instance.Drop(keepUnusedSchedules)
public void Drop(
bool keepUnusedSchedules
)
public:
void Drop(
bool keepUnusedSchedules
)
member Drop :
keepUnusedSchedules:bool -> unit
public function Drop(
keepUnusedSchedules : boolean
)
Параметры
- keepUnusedSchedules
Тип: 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.
Примеры
The following code example creates a job schedule and shares it between two jobs.
C#
Server srv = new Server("(local)");
Job jb = new Job(srv.JobServer, "Test Job");
Job jb2 = new Job(srv.JobServer, "Second Test Job");
jb.Create();
jb2.Create();
JobSchedule jbsch = new JobSchedule(jb, "Test Job Schedule");
jbsch.Create();
jb2.AddSharedSchedule(jbsch.ID);
jb.Drop(true);
PowerShell
$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$jb = new-object Microsoft.SqlServer.Management.Smo.Agent.Job($srv.JobServer, "Test Job")
$jb2 = new-object Microsoft.SqlServer.Management.Smo.Agent.Job($srv.JobServer, "Second Test Job")
$jb.Create()
$jb2.Create()
$jbsch = new-object Microsoft.SqlServer.Management.Smo.Agent.JobSchedule($jb, "Test Job Schedule")
$jbsch.Create()
$jb2.AddSharedSchedule($jbsch.ID)
$jb.Drop($TRUE)
См. также
Справочник
Пространство имен Microsoft.SqlServer.Management.Smo.Agent
Другие ресурсы
Задачи автоматизированного администрирования (агент SQL Server)
Планирование автоматических административных задач в агенте SQL Server