How to Enable multiple SQL agent Jobs using single SQL Query

Here is the SQL query to Enable multiple SQL Agents Jobs.

exec sp_configure ‘allow updates’,1

go

reconfigure with override

go

update msdb.dbo.sysjobs

set [enabled] = 1

where name like ‘Ownership Standardization%’

go

exec sp_configure ‘allow updates’,0

go

reconfigure with override

go

To disable multiple jobs just replace “set enabled = 1” line with “set enabled = 0” in query.

This query can be very useful in case you need to enable or disable multiple jobs having common string in their names.

Advertisements

About Ashish Jain

I am Ashish Jain, a software engineer by profession. My goal of creating this blog is to share my knowledge of SQL server with all other SQL enthusiasts and also to learn from them.
This entry was posted in Advanced SQL and tagged , , , . Bookmark the permalink.

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