Job.NextRunDate Job.NextRunDate Job.NextRunDate Property

정의

작업을 실행하도록 예약된 다음 날짜 및 시간을 가져옵니다. Gets the date and time when the job is next scheduled to run.

public:
 property DateTime NextRunDate { DateTime get(); };
[Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcProperty(Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcPropertyFlags.Expensive | Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcPropertyFlags.Standalone)]
public DateTime NextRunDate { get; }
Public ReadOnly Property NextRunDate As DateTime
속성 값

작업이 다음에 실행될 날짜 및 시간을 지정하는 DateTime 값입니다. A DateTime value that specifies the date and time when the job is next scheduled to run.

예제

다음 코드 예제에서는 작업과 연결된 된 일정 한 다음 표시 합니다. 다음 예약 된 날짜를 실행된 합니다.The following code example creates a job and an associated schedule, then displays the next scheduled run date.

C#C#

Server srv = new Server("(local)");  
Job jb = new Job(srv.JobServer, "Test Job");  
jb.Create();  
JobSchedule jbsch = new JobSchedule(jb, "Test Job Schedule");  
jbsch.FrequencyTypes = FrequencyTypes.Daily;  
jbsch.FrequencySubDayTypes = FrequencySubDayTypes.Minute;  
jbsch.FrequencySubDayinterval = 30;  
Timespan ts1 = new Timespan(9, 0, 0);  
Timespan ts2 = new Timespan(17, 0, 0);  
jbsch.ActiveStartTimeOfDay = ts1;  
jbsch.ActiveEndTimeOfDay = ts2;  
jbsch.FequencyInterval = 1;  
DateTime d = new DateTime(2004, 1, 1);  
jbsch.ActiveStartDate = d;  
jbsch.Create();  
Console.WriteLine(jb.NextRunDate.ToString());  

PowerShellPowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")  
$jb = new-object Microsoft.SqlServer.Management.Smo.Agent.Job($srv.JobServer, "Test Job")  
$jb.Create()  
$jbsch = new-object Microsoft.SqlServer.Management.Smo.Agent.JobSchedule($jb, "Test Job Schedule")  
$jbsch.FrequencyTypes = [Microsoft.SqlServer.Management.Smo.Agent.FrequencyTypes]::Daily  
$jbsch.FrequencySubDayTypes = [Microsoft.SqlServer.Management.Smo.Agent.FrequencySubDayTypes]::Minute  
$jbsch.FrequencySubDayinterval = 30  
$ts1 = new-object System.TimeSpan(9, 0, 0)  
$ts2 = new-object System.TimeSpan(17, 0, 0)  
$jbsch.ActiveStartTimeOfDay = $ts1  
$jbsch.ActiveEndTimeOfDay = $ts2  
$jbsch.FrequencyInterval = 1  
$d = new-object System.DateTime(2003, 1, 1)  
$jbsch.ActiveStartDate = $d  
$jbsch.Create()  
Write-Host $jb.NextRunDate  

적용 대상