Enable/Disable Sql Server Agent using a t-sql script

Jill picture Jill · Apr 19, 2012 · Viewed 29.5k times · Source

Is it possible to enable or disable the sql server agent using t-sql?

Answer

Russell Fox picture Russell Fox · Apr 19, 2012
exec msdb..sp_update_job @job_name = 'Job Name', @enabled = 0 --Disable
exec msdb..sp_update_job @job_name = 'Job Name', @enabled = 1 --Enable