Deactivate jobs on SQL Server

/ Published in: SQL
Save to your folder(s)

Let's say you need to deactivate jobs, do something, then reactivate jobs. You can use this to generate the code for both by changing "@enabled = 0" with 1

Copy this code and paste it in your HTML
  1. SELECT 'exec msdb..sp_update_job @job_name = ''' + name + ''', @enabled = 0'
  2. FROM msdb..sysjobs
  3. WHERE enabled = 1

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.