Job.Start Job.Start Job.Start Method

정의

참조된 작업을 실행합니다. Runs the referenced job.

오버로드

Start() Start() Start()

참조된 작업을 실행합니다. Runs the referenced job.

Start(String) Start(String) Start(String)

지정한 작업 단계부터 참조된 작업을 실행합니다. Runs the referenced job starting at the specified job step.

Start() Start() Start()

참조된 작업을 실행합니다. Runs the referenced job.

public:
 void Start();
public void Start ();
Public Sub Start ()

예제

다음 코드 예제에서는 작업을 만들고 시작 합니다.The following code example creates a job and starts it.

C#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();  
jb.ApplyToTargetServer(srv.Name);  
jb.IsEnabled = true;  
jb.Start();  

PowerShellPowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")  
$jb = new-object Microsoft.SqlServer.Management.Smo.Agent.Job($srv.JobServer, "Testrrt Job")  
$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()  
$jb.ApplyToTargetServer($srv.Name)  
$jb.IsEnabled = $TRUE  
$jb.Start()  

Start(String) Start(String) Start(String)

지정한 작업 단계부터 참조된 작업을 실행합니다. Runs the referenced job starting at the specified job step.

public:
 void Start(System::String ^ jobStepName);
public void Start (string jobStepName);
Public Sub Start (jobStepName As String)
매개 변수
jobStepName
String String String

실행을 시작할 작업 단계를 지정하는 String 값입니다. A String value that specifies the job step to start execution.

예제

다음 코드 예제에서는 작업을 만들고 지정 된 작업 단계에서 시작 합니다.The following code example creates a job and starts it at the specified job step.

C#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();  
jb.ApplyToTargetServer(srv.Name);  
jb.IsEnabled = true;  
jb.Start("Test Job Step");  

PowerShellPowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")  
$jb = new-object Microsoft.SqlServer.Management.Smo.Agent.Job($srv.JobServer, "Testrrt Job")  
$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()  
$jb.ApplyToTargetServer($srv.Name)  
$jb.IsEnabled = $TRUE  
$jb.Start("Test Job Step")  

적용 대상