JobSchedules プロパティ
ジョブに割り当てられたスケジュールを表す JobSchedule オブジェクトのコレクションを取得します。
名前空間: Microsoft.SqlServer.Management.Smo.Agent
アセンブリ: Microsoft.SqlServer.Smo (Microsoft.SqlServer.Smo.dll)
構文
'宣言
<SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.ZeroToAny, _
GetType(JobSchedule))> _
Public ReadOnly Property JobSchedules As JobScheduleCollection
Get
'使用
Dim instance As Job
Dim value As JobScheduleCollection
value = instance.JobSchedules
[SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.ZeroToAny,
typeof(JobSchedule))]
public JobScheduleCollection JobSchedules { get; }
[SfcObjectAttribute(SfcContainerRelationship::ChildContainer, SfcContainerCardinality::ZeroToAny,
typeof(JobSchedule))]
public:
property JobScheduleCollection^ JobSchedules {
JobScheduleCollection^ get ();
}
[<SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.ZeroToAny,
typeof(JobSchedule))>]
member JobSchedules : JobScheduleCollection
function get JobSchedules () : JobScheduleCollection
プロパティ値
型: Microsoft.SqlServer.Management.Smo.Agent. . :: . .JobScheduleCollection
JobSchedule オブジェクトのコレクションを示す JobScheduleCollection オブジェクトの値です。
使用例
次のコード例では、ジョブおよび関連付けられたスケジュールを作成します。
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());
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()
$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