Свойство Job.JobSteps
Gets a collection of JobStep objects that represent the job steps defined for the job.
Пространство имен: Microsoft.SqlServer.Management.Smo.Agent
Сборка: Microsoft.SqlServer.Smo (в Microsoft.SqlServer.Smo.dll)
Синтаксис
'Декларация
<SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.ZeroToAny, _
GetType(JobStep))> _
Public ReadOnly Property JobSteps As JobStepCollection
Get
'Применение
Dim instance As Job
Dim value As JobStepCollection
value = instance.JobSteps
[SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.ZeroToAny,
typeof(JobStep))]
public JobStepCollection JobSteps { get; }
[SfcObjectAttribute(SfcContainerRelationship::ChildContainer, SfcContainerCardinality::ZeroToAny,
typeof(JobStep))]
public:
property JobStepCollection^ JobSteps {
JobStepCollection^ get ();
}
[<SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.ZeroToAny,
typeof(JobStep))>]
member JobSteps : JobStepCollection
function get JobSteps () : JobStepCollection
Значение свойства
Тип: Microsoft.SqlServer.Management.Smo.Agent.JobStepCollection
A JobStepCollection object value that specifies a collection of JobStep objects.
Примеры
The following code example creates a job and an associated job step.
C#
Server srv = new Server("(local)");
Job jb = new Job(srv.JobServer, "Test Job");
jb.Create();
JobStep jbstp = new JobStep(jb, "Test Job Step");
jbstp.OnSuccessAction = StepCompletionAction.QuitWithSuccess;
jbstp.OnFailAction = StepCompletionAction.QuitWithFailure;
jbstp.Create();
Console.WriteLine(jb.JobSteps.ToString());
PowerShell
$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$jb = new-object Microsoft.SqlServer.Management.Smo.Agent.Job($srv.JobServer, "Test Job23", 3)
$jb.Create()
$jbstp = new-object Microsoft.SqlServer.Management.Smo.Agent.JobStep($jb, "Test Job Step")
$jbstp.OnSuccessAction = [Microsoft.SqlServer.Management.Smo.Agent.StepCompletionAction]::QuitWithSuccess
$jbstp.OnFailAction = [Microsoft.SqlServer.Management.Smo.Agent.StepCompletionAction]::QuitWithFailure
$jbstp.Create()
Write-Host $jb.JobSteps
См. также
Справочник
Пространство имен Microsoft.SqlServer.Management.Smo.Agent
Другие ресурсы
Задачи автоматизированного администрирования (агент SQL Server)
Планирование автоматических административных задач в агенте SQL Server