3

I created a new SQL Server job which will run once a year, it's currently enabled and configured to run on 1st day of new year.

In order to make sure configuration date is correct, I run this command:

sp_help_jobschedule @job_name = 'MyJobName'

It returns "next_run_date" and "next_run_time" as 0.

How can I see next_run_date and next_run_time of a new SQL Server job which never executed before?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
doganak
  • 798
  • 14
  • 31
  • My command returned the result later. The reason was "The sysjobschedules table refreshes every 20 minutes, which may affect the values returned by the sp_help_jobschedule stored procedure." Reference: msdn.microsoft.com/en-gb/library/ms188924(v=sql.105).aspx – doganak Nov 01 '18 at 08:41
  • hmmmm, so what is the sql to ask this question? – Jonesome Reinstate Monica Nov 19 '18 at 17:50

2 Answers2

4

You can also view the next run datetime from Management Studio. In your SQL Server agent you can find Job Activity Monitor (doublic click on it).

enter image description here

Then you will see the next run column

Community
  • 1
  • 1
liotims
  • 424
  • 2
  • 18
  • My command returned the result later. The reason was "The sysjobschedules table refreshes every 20 minutes, which may affect the values returned by the sp_help_jobschedule stored procedure." Reference: https://msdn.microsoft.com/en-gb/library/ms188924(v=sql.105).aspx – doganak Dec 30 '16 at 14:09
0

You need to look at msdb.dbo.sysschedules .The column freq_type would give the frequency of job..

1 = One time only

4 = Daily

8 = Weekly

16 = Monthly

32 = Monthly, relative to freq_interval

64 = Runs when the SQL Server Agent service starts

128 = Runs when the computer is idle

TheGameiswar
  • 27,855
  • 8
  • 56
  • 94