Avatar of motioneye
motioneye
Flag for Singapore

asked on 

How to disable/enable multiple sql jobs in efficient way

Guys,

I was thinking to perform some multiple update with sql job, which to set them disabled at specific time and again set it again enable, here is my query, does anyone here have better than a query below to do update?


USE MSDB;
GO
UPDATE J
SET J.Enabled = 0
FROM MSDB.dbo.sysjobs J
INNER JOIN MSDB.dbo.syscategories C
ON J.category_id = C.category_id
WHERE C.[Name] in
('JOB1','JOB2','JOB5','JOB20'
)
GO
Microsoft SQL ServerMicrosoft SQL Server 2005

Avatar of undefined
Last Comment
Nakul Vachhrajani

8/22/2022 - Mon