SQL服务器作业动态计划

时间:2013-08-19 13:06:46

标签: sql-server tsql sql-job

我有一组SQL服务器作业,我希望它们的计划是动态的,即我希望下一个运行日期来自一个表。

我尝试更新next_run_date表中的sysjobschedulesnext_scheduled_run_date表中的sysjobactivity,但这没有做任何事情。

我该怎么做?

1 个答案:

答案 0 :(得分: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 ]