How Do I Display the Correct Next Run Time for a SQL Server Agent Job

  • Hi everyone!

    I've been working on a vb.net application. There is a section in our application that displays the current next run time. We allow the users to change the time it runs.

    When the time is set, sp_update_jobschedule runs with the requested time. This portion seems to run correctly.

    We know this because checking the job properties by right clicking and selecting properties in the Microsoft SQL Server Management Studio we see the correct time the user set it at.

    However in the vb.net app we basically run a select off of next_run_time.sysjobschedules. For whatever reason the correct time the user had just set is not displayed. I am guessing the time will correct itself once the job actually runs again.

    Here are my questions:

    1) Is there any way to force the 'next_run_time' to show the correct time it will run again without running the job first?

    2) is there a better way to display the real 'next_run_time'?

    3) What is the best way to show a user when the next run time is going to be?

    I hope someone out there can answer these questions! Thanks in advance.

  • Are you re-running your select of next_run_time in the VB.NET app after you set the time.

  • Yes, and I select through SQL Management Studio to double check as well.

    Though when I check through the SQL Management Studio GUI it shows the correct next run time. I need to capture it when the application.

    Any help or suggestions would be appreciated.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply