June 23, 2009 at 3:43 am
Hi
In SMS when I enable a disabled job, the next run field is updated.
When I do this by setting enable = 1 in sysjobs, the next run is not updated, and the job nevers starts.
What an I missing ?
Patrick - sql 2008
June 23, 2009 at 8:25 am
Do you mean , you are updating the value directly in the system tables. if yes: this is not advisable and should be dne through the Job properties only. as the vvalue might be updates into several sys tables....
Maninder
www.dbanation.com
June 23, 2009 at 9:32 am
Patrick ISAMBERT (6/23/2009)
HiIn SMS when I enable a disabled job, the next run field is updated.
When I do this by setting enable = 1 in sysjobs, the next run is not updated, and the job nevers starts.
What an I missing ?
It could be because the job and schedule are stored in different system tables and when you enable a job using the GUI, the next run date is is updated behind the scenes. When you update sysjobs manually, you're not updating sysjobschedules.
Remember also that jobs and schedules can be enabled or disabled independently, so when you enable a job you should make sure that the schedule is also enabled.
Greg
June 23, 2009 at 10:15 am
If you want to enable \ disable the jobs through tsql please dont update the systables directly instead MS has provided a procedure to do this in MSDB database. Try the procedure below, it will disable the schedule too.
EXEC msdb.dbo.sp_update_job @job_name='Jobname', @enabled=0
Regards..Vidhya Sagar
SQL-Articles
June 23, 2009 at 5:25 pm
I believe you have to run msdb.dbo.sp_update_jobschedule to disable a schedule.
Greg
June 24, 2009 at 11:15 am
Thanks to all of you
Effectively, updating system tables directly was a bad idea ....
Patrick
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply