Solved

SQL script to script out all sql jobs

Posted on 2009-07-10
5
320 Views
Last Modified: 2012-06-27
I need a single sql script to script out all existing sql agent jobs.  The scripts need to be the same functionality of the CREATE TO funcationilty in order to be able to recreate the jobs on another server in the event of a system failure.

Any suggestions appreciated!
0
Comment
Question by:ilibhart80
  • 2
5 Comments
 
LVL 17

Expert Comment

by:pssandhu
ID: 24824376
Does this help? I do not have SQL Server 2000 instance running so i cannot test if this does all jobs at once.
http://msdn.microsoft.com/en-us/library/aa177024(SQL.80).aspx
P.
0
 

Author Comment

by:ilibhart80
ID: 24825363
I need to be able to automatically perform the above links steps in a maintenance plan that I can run weekly.  

I need to know how I can have those CREAT scripts stored somewhere as a backup to quickly recreate the jobs if there is a hardware failure.
0
 
LVL 17

Accepted Solution

by:
pssandhu earned 500 total points
ID: 24826355
I do not think there is any straight foward way to do this in SSMS. I think you are better of wrting a small vbscript to interface with the SMO/DMO API to script all jobs to a file. Check this out:
http://social.msdn.microsoft.com/Forums/en-US/sqlsmoanddmo/thread/c2bad100-ac38-42f0-a381-2780d1d5c243
Once successfull you schedule the script execution.
Hope this helps.
P.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 24828661
In order to quickly recreate the jobs right click on Jobs, select "All tasks" and then "Generate SQL Script"
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Syntax 5 34
Loop to go backward 90 days 2 18
string fuctions 4 25
Connecting to multiple databases to create a Dashboard 5 23
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question