Job.RemoveSharedSchedule 메서드 (Int32)

Removes the specified shared schedule from the job.

네임스페이스:  Microsoft.SqlServer.Management.Smo.Agent
어셈블리:  Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)

구문

‘선언
Public Sub RemoveSharedSchedule ( _
    scheduleId As Integer _
)
‘사용 방법
Dim instance As Job 
Dim scheduleId As Integer

instance.RemoveSharedSchedule(scheduleId)
public void RemoveSharedSchedule(
    int scheduleId
)
public:
void RemoveSharedSchedule(
    int scheduleId
)
member RemoveSharedSchedule : 
        scheduleId:int -> unit
public function RemoveSharedSchedule(
    scheduleId : int
)

매개 변수

  • scheduleId
    유형: System.Int32
    An Int32 value that specifies the ID value that uniquely identifies the shared schedule.

The following code example creates a job schedule, shares it between two jobs, then removes it from one of them.

C#

Server srv = new Server("(local)");
Job jb = new Job(srv.JobServer, "Test Job");
Job jb2 = new Job(srv.JobServer, "Second Test Job");
jb.Create();
jb2.Create();
JobSchedule jbsch = new JobSchedule(jb, "Test Job Schedule");
jbsch.Create();
jb2.AddSharedSchedule(jbsch.ID);
jb.RemoveSharedSchedule(jbsch.ID);

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$jb = new-object Microsoft.SqlServer.Management.Smo.Agent.Job($srv.JobServer, "Test Job")
$jb2 = new-object Microsoft.SqlServer.Management.Smo.Agent.Job($srv.JobServer, "Second Test Job")
$jb.Create()
$jb2.Create()
$jbsch = new-object Microsoft.SqlServer.Management.Smo.Agent.JobSchedule($jb, "Test Job Schedule")
$jbsch.Create()
$jb2.AddSharedSchedule($jbsch.ID)
$jb.RemoveSharedSchedule($jbsch.ID)

참고 항목

참조

Job 클래스

RemoveSharedSchedule 오버로드

Microsoft.SqlServer.Management.Smo.Agent 네임스페이스

관련 자료

SQL Server 에이전트에서 자동 관리 태스크 예약

관리 태스크 자동화(SQL Server 에이전트)

sp_delete_schedule(Transact-SQL)