code_junkie

How to bulk-amend the job step command in ALL sql server agent jobs

Nov 12th, 2011
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. msdb.dbo.SysJobs
  2. msdb.dbo.SysJobSteps
  3.  
  4. UPDATE SJS SET
  5. Command = REPLACE(Command, 'EmailAddress&TestDomain.Com', '')
  6. FROM msdb.dbo.SysJobs SJ
  7. INNER JOIN msdb.dbo.SysJobSteps SJS
  8. ON SJS.Job_Id = SJ.Job_Id
  9. WHERE SJ.Originating_server = ..... -- Your server here
  10. AND SJS.Command LIKE '%[email protected]%'
Add Comment
Please, Sign In to add comment