SQL Server Central is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

Copy all jobs, job steps and job schedules

By rhandloff, 2003/04/17

Total article views: 418 | Views in the last 30 days: 14

This vbscript will generate the sql to recreate all the jobs running on a given SQL server. I wrote this because the last time we migrated a SQL server, I ended up re-creating all the jobs, steps and schedules by hand using the Enterprise Manager. It was the slowest, dullest and most error-prone part of the migration. Being a lazy programmer (aren't all good programmers lazy?) and being in love with scripting languages (especially Perl and VBScript) I thought I would throw a quick little script together to do the job.

So, set up a udl and capture the output to a text file. Paste the sql statements into the query analyzer and voila!

You could easily use a connection object to execute the sql as it ran, or save it to a file and then call osql through a command shell, but I chose not to do that since our migration will be stressful enough without worrying that something went wrong with the script. I'd rather see the SQL and paste it into the query analyzer prior to executing the SQL.

By rhandloff, 2003/04/17

Total article views: 418 | Views in the last 30 days: 14
Your response
 
 
Related tags
 
Already registered?  

Free registration required

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Register

E-mail address:
Password:
Password (confirm):

  

Subscriptions

We ask you to register on the site and subscribe to our newsletters. Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

We ask that you give the newsletter a try for a week. Over 200,000 SQL Server Professionals a day find it entertaining and useful. If not, you are welcome to unsubscribe at anytime.

Steve Jones
Editor, SQLServerCentral.com