Results 1 to 4 of 4
  1. #1
    Join Date
    May 2003
    Posts
    2

    Unanswered: Next_run_time and next_run_date of sysjobschedules

    I have written some code to query the next_run_time and next_run_date of the sysjobschedules table. It works well with the exception that when a new schedule is created or an existing one is changed, these two columns are set to zero. They will eventually be initialized to the appropriate values but that may take a while. That means that the code will not work until then.

    Is there a way to FORCE the initialization of the two columns ?

  2. #2
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    How does your code looks like?
    Tried initializing those 2 values in the code itself?
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

  3. #3
    Join Date
    May 2003
    Posts
    2
    The code is simply selecting the two columns into variables and then do further processing.

    The problem is the two columns (next_run_date and next_run_time) of sysjobschedules table are set to zero whenever a new schedule is created or changed. You can try it yourselef.

    Create a job (xxxxx) with a schedule.

    select a.name, b.name,next_run_date, next_run_time from msdb..sysjobs a inner join msdb..sysjobschedules b
    on a.job_id=b.job_id
    where a.name='xxxxx'

    and you will see those two columns are zeros.

    However, after a while they will updated to the appropriate values by SQL.

    My question, how do we force SQL to update these two columns immediately? It seems SQL keeps them in cache somewhere and periodically updates the sysjobschedules table.

  4. #4
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    True, what you said is right.

    I believe as soon as the job finishes the execution these values will be updated internally and only with manual updation you can set other values if required.

    May refer to book 'Inside SQL Server 2000' by Kalen Daleney.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •