SQL Stuff

Disable All Jobs In SQL Server

Here’s a quick you can use to disable all Jobs.
–to disable all jobs run this.
use msdb;
set nocount on
declare @disable_all_jobs varchar(max)
set @disable_all_jobs = ”
select @disable_all_jobs = @disable_all_jobs +
‘sp_update_job @job_name = ”’ + name + ”’, @enabled = ”0”’ + char(10) + ‘go’ + char(10) from sysjobs
exec (@disable_all_jobs)
go

–to enable all the jobs just run this.
use msdb;
set nocount on
declare @enable_all_jobs varchar(max)
set @enable_all_jobs = ”
select @enable_all_jobs = @enable_all_jobs +
‘sp_update_job @job_name = ”’ + name + ”’, @enabled = ”1”’ + char(10) + ‘go’ + char(10) from sysjobs
exec (@enable_all_jobs)
go

Advertisements

Categories: SQL Stuff

Tagged as: , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s