Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Server Agent

Author  Topic 

ckuo@kahluadesigns.com
Yak Posting Veteran

58 Posts

Posted - 2004-06-25 : 16:03:38
Hi,
When I add/update sysjobschedules, the Sql Server Agent updates the next_run_date and next_run_time fields, but there is a delay from when I've update that entire row. How can I have those two fields be calculated right after I have updated the row? Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-06-25 : 16:13:19
If you used sp_add_jobschedule like you should be, it would all be handled by it. If you look inside this stored procedure in the msdb database you'll notice it is using sp_sqlagent_notify to notify the SQLAgent of changes. I guess you could use it too. You should always use the system stored procedures to modify system tables if one exists.

Tara
Go to Top of Page

ckuo@kahluadesigns.com
Yak Posting Veteran

58 Posts

Posted - 2004-06-28 : 11:07:11
Thanks for the info. I have a trigger that adds/updates jobs and schedules using the system stored procedures. I did notice that at the end of the sp_add_jobschedule that it calls sp_sqlagent_notify so SQL Agent can calculate the next_run_date. The problem is, even though SQL Agent is notified, it does not calculate the next_run_date immediately. At the end of my Trigger, I need to calculate the next_run_date so that I can proceed with some other stuff. Is there code to manually calculate it myself? Or can I manually poll SQL Agent for the date? Thanks.
Go to Top of Page

ckuo@kahluadesigns.com
Yak Posting Veteran

58 Posts

Posted - 2004-06-30 : 11:34:47
Anybody know how I can speed up the time it takes SQLAgent to recalculate a job's next run date AFTER its has been notified of a change? It takes about 10 mins right now. Thanks
Go to Top of Page
   

- Advertisement -