Export (0) Print
Expand All

Job.HasStep Property

Gets the Boolean property value that specifies whether the job has at least one job step.

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

[SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Expensive|SfcPropertyFlags.Standalone|SfcPropertyFlags.Matrix)]
public bool HasStep { get; }

Property Value

Type: Boolean
A Boolean value that specifies whether the job has at least one job step.If True, the job has at least one job step. If False, the job does not have any job steps.

Microsoft SQL Server Agent jobs must have at least one job step to be executable. Define and add JobStep objects to the JobSteps collection of a Job object to create job steps. This alters the value of the HasStep property.

The following code example indicates whether the job has at least one job step.

C#

Server srv = new Server("(local)");
Job jb = new Job(srv.JobServer, "Test Job");
Console.WriteLine(jb.HasStep);

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$jb = new-object Microsoft.SqlServer.Management.Smo.Agent.Job($srv.JobServer, "Test Job")
Write-Host $jb.HasStep 

Community Additions

ADD
Show:
© 2014 Microsoft