job scheduling - SQL Agent job doesnt start after disabling and enabling through script -


we have several jobs want disable , later enabled. used following (source: "https://www.mssqltips.com/sqlservertip/1400/disabling-or-enabling-sql-server-agent-jobs/"):

use msdb; go update msdb.dbo.sysjobs set enabled = 0 [name] '%ourspecifictext%'; go 

first "0" , later "1"

jobs , schedules , still enabled, table dbo.sysjobschedules tells next time start , not sure these values correct. result after re-enabling, none of jobs worked again! had rush , start them manually ssms not sure of later, seems next_run_date , time fields on dbo.sysjobschedules not update correctly.

it seems script found on page wrong , better use sproc (sp_update_job).

we know next time (calling sproc) need know happened. question is: prevented execution of jobs after enabling through sysjobs table? updates fields next_run_date , time on sysjobschedules table?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -