Just Code‎ > ‎

SSMS/Visual Studio - Find Replace - Use Regex to create one task for each row in the editor

posted Nov 14, 2011, 7:40 AM by Peter Henell   [ updated Nov 14, 2011, 11:38 PM ]

Begin with these rows, you want to execute all of these jobs.
Job1
Job2
Job3
Job4
Job5

Apply this Find and replace Regex
Find:
^({.*})$
Replace:
EXEC MSDB..sp_start_job '\1'

smssRegexReplace

Result
EXEC MSDB..sp_start_job 'Job1'
EXEC MSDB..sp_start_job 'Job2'
EXEC MSDB..sp_start_job 'Job3'
EXEC MSDB..sp_start_job 'Job4'
EXEC MSDB..sp_start_job 'Job5'
Comments