How to mass update all or some sql server agent job step and commands using TSQL. This will use the built-in Replace function to search text in SQL agent jobs SQL Agent Job information is stored in MSDB and can reviewed using some of the following queries: SELECT * FROM msdb.dbo.SysJobs SELECT * FROM msdb.dbo.SysJobSteps -- OR SELECT a.name as job_name, b.step_name, b.subsystem, b.command, b.database_name, a.enabled ,a.description, a.date_created, b.job_id, b.step_id FROM [dbo].[sysjobsteps] as b INNER JOIN sysjobs as a ON a.job_id = b.job_id Since I will be focusing on the Commands column I will look at using this query to extract data into a temp table so that I can test any updates with the replace step before doing an update to MSDB. This would be your opportunity to archive or save any commands as needed. Some people may prefer to generate all the syntax necessary to use EXEC sp_update_jobstep so you a...
Comments
Post a Comment