Dynamic SQL Server Schedule

I have a set of SQL server tasks, and I want the graph for them to be dynamic, i.e. I want the next launch date to come from the table.

I tried updating next_run_date in the sysjobschedules table and next_scheduled_run_date in the sysjobactivity table, but that does nothing.

How can i do this?

+4
source share
1 answer

I think you can use - sp_update_schedule to update the 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]
+3
source

Source: https://habr.com/ru/post/1497791/


All Articles