Welcome to MSDN Blogs Sign in | Join | Help
Script out Jobs in SQL Server

Do you want to script out the jobs available in SQL Server Agent ? There a many ways to skin the cat.

  • The probably easiest one is to us the built in functionality of SSMS. Simply select all the jobs (doing a STRG+A on the Object Explorer list) and choose Script.

ScriptSQLServerJobs

  • Script jobs separately (this can get tedious with having hundreds of Jobs :-))

ScriptSQLServerJobs_Simple

  • Use a simple SMO Application which can connect to the JobServer, query for jobs and write them down in a separate file. In addition it will create a calling .sql-Script file and a batch command which is parameterized to execute it against a new server. For geeks sake, I wrote this small Consoleapplication and attached it to this thread for your reference and further use.

image

If you have feedback on that or things that could be better, feel free to write me a feedback.

-Jens

Posted: Tuesday, January 27, 2009 8:45 PM by Jens K. Suessmeyer
Attachment(s): JobScripter.zip

Comments

Adrian said:

Good day, the JobScripter, can be run on sql server 2008? Thank you very much.

# August 30, 2009 10:28 AM

Jens K. Suessmeyer said:

No, the jobscripter scripts jobs for all SQL Server targets that are supported by the SMO 9.0 interface which is down to SQL Server 7.0.

If you have any issues or fetaure requests with the scripter, feel free to drop me a mail.

-Jens

# August 30, 2009 12:58 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker