Today, I have come across a requirement to generate the sql script for SQL Server Jobs (only few out of thousands). Most of us are familiar with an approach by right click on the sql job and choose ‘Script Job as’ to script out individually, but this is such a tedious job if you have couple of sql jobs to be scripted.
This post explains another simpler way using “Object Explorer Details“. It allows you to select multiple jobs to be scripted as below.
- Choose Object Explorer Details Menu from View main menu in SSMS.
- Select “SQL Server Agent” -> “Jobs” in Object explorer which lists all the SQL Agent Jobs in Details.
- Select the jobs (ALL or FEW) you want to script and then right click to select the scripting option.
The above steps will create all the selected jobs in a single query window as per the selection.
If you enjoyed this blog post, please feel free to share it with your friends!