2013-08-19 4 views
4

SQL 서버 작업 세트가 있고 동적 인 스케줄을 원합니다. 즉 테이블에서 다음 실행 날짜를 원합니다.SQL 서버 작업 동적 스케줄

sysjobschedules 테이블에서 next_run_date을 업데이트하려고 시도했으며 next_scheduled_run_date 테이블에서 sysjobactivity 테이블을 업데이트하려고 시도했지만 아무 것도 수행하지 않습니다.

어떻게하면됩니까?

답변

3

나는 sp_update_schedule을 사용하여 일정을 업데이트 할 수 있다고 생각합니다.

 
sp_update_schedule 
    { [ @schedule_id = ] schedule_id 
     | [ @name = ] 'schedule_name' } 
    [ , [ @new_name = ] new_name ] 
    [ , [ @enabled = ] enabled ] 
    [ , [ @freq_type = ] freq_type ] 
    [ , [ @freq_interval = ] freq_interval ] 
    [ , [ @freq_subday_type = ] freq_subday_type ] 
    [ , [ @freq_subday_interval = ] freq_subday_interval ] 
    [ , [ @freq_relative_interval = ] freq_relative_interval ] 
    [ , [ @freq_recurrence_factor = ] freq_recurrence_factor ] 
    [ , [ @active_start_date = ] active_start_date ] 
    [ , [ @active_end_date = ] active_end_date ] 
    [ , [ @active_start_time = ] active_start_time ] 
    [ , [ @active_end_time = ] active_end_time ] 
    [ , [ @owner_login_name = ] 'owner_login_name' ] 
    [ , [ @automatic_post =] automatic_post ] 
+0

이 SP를 보았지만 다음 실행일은 없습니다. 이것을 사용하면 매번 새로운 시작 일정을 만들거나 활성 시작일을 변경하는 것과 같습니까? – evoandy

+0

'sysjobschedules'에서'next_run_date'를 업데이트해도 문제가 해결되지 않습니다. 'sysjobschedules' 테이블은 20 분마다 새로 고침됩니다. 'freq_interval, freq_subday_type, freq_subday_interval, freq_relative_interval, freq_recurrence_factor, active_start_date, active_start_time' 등 다양한 다른 필드에 의존합니다. 따라서 다음 실행 날짜를 변경하려면이 필드를 참조해야합니다. – AgentSQL

+0

자세한 내용은 [this] (http://sqlmag.com/t-sql/plugging-gaps-sql-server-job-tracking) 사이트를 방문하십시오. – AgentSQL