Enable/Disable SQL Jobs

 --Enable All SQL jobs at once

USE msdb;

GO

 

-- Enable all SQL Server Agent jobs

UPDATE msdb.dbo.sysjobs

SET enabled = 1

WHERE enabled = 0;  -- Only update jobs that are currently disabled

 

-- Verify the status of the jobs

SELECT name, enabled

FROM msdb.dbo.sysjobs;

 

--Disable All Jobs at once

USE msdb;

GO

 

-- Disable all SQL Server Agent jobs

UPDATE msdb.dbo.sysjobs

SET enabled = 0

WHERE enabled = 1;  -- Only update jobs that are currently enabled

 

-- Verify the status of the jobs

SELECT name, enabled

FROM msdb.dbo.sysjobs;

 

No comments:

Post a Comment

Popular Posts