Share via


Job.CurrentRunStep 属性

Gets information about the job step that is currently running.

命名空间:  Microsoft.SqlServer.Management.Smo.Agent
程序集:  Microsoft.SqlServer.Smo(在 Microsoft.SqlServer.Smo.dll 中)

语法

声明
<SfcPropertyAttribute(SfcPropertyFlags.None Or SfcPropertyFlags.Expensive Or SfcPropertyFlags.Standalone)> _
Public ReadOnly Property CurrentRunStep As String 
    Get
用法
Dim instance As Job 
Dim value As String 

value = instance.CurrentRunStep
[SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Expensive|SfcPropertyFlags.Standalone)]
public string CurrentRunStep { get; }
[SfcPropertyAttribute(SfcPropertyFlags::None|SfcPropertyFlags::Expensive|SfcPropertyFlags::Standalone)]
public:
property String^ CurrentRunStep {
    String^ get ();
}
[<SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Expensive|SfcPropertyFlags.Standalone)>]
member CurrentRunStep : string
function get CurrentRunStep () : String

属性值

类型:System.String
A String value that specifies the job step that is currently running.

注释

For executing jobs, the property reports the job step by number, and the name of the job step as a string, for example: 2 (Run Replication Agent.).

示例

The following code example creates a new job and displays its current step.

C#

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

PowerShell

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

请参阅

参考

Job 类

Microsoft.SqlServer.Management.Smo.Agent 命名空间

其他资源

自动执行管理任务(SQL Server 代理)

sp_add_job (Transact-SQL)

在 SQL Server 代理中计划自动管理任务