Job.JobSchedules Job.JobSchedules Job.JobSchedules Property

정의

컬렉션을 가져옵니다 JobSchedule 작업에 할당 된 일정을 나타내는 개체입니다. Gets a collection of JobSchedule objects that represent the schedules assigned to the job.

public:
 property Microsoft::SqlServer::Management::Smo::Agent::JobScheduleCollection ^ JobSchedules { Microsoft::SqlServer::Management::Smo::Agent::JobScheduleCollection ^ get(); };
[Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcObject(Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcContainerRelationship.ChildContainer, Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcContainerCardinality.ZeroToAny, typeof(Microsoft.SqlServer.Management.Smo.Agent.JobSchedule))]
public Microsoft.SqlServer.Management.Smo.Agent.JobScheduleCollection JobSchedules { get; }
Public ReadOnly Property JobSchedules As JobScheduleCollection
속성 값

JobScheduleCollection 개체 컬렉션을 지정하는 JobSchedule 개체 값입니다. A JobScheduleCollection object value that specifies a collection of JobSchedule objects.

예제

다음 코드 예제에서는 작업 및 연결된 된 일정을 만듭니다.The following code example creates a job and an associated schedule.

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.Schedules.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.JobSchedules  

적용 대상