SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Copy all jobs, job steps and job schedules

By rhandloff,

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.

Total article views: 756 | Views in the last 30 days: 4
Related Articles




Views(script) migrating

Is there any wizard to migrate views(script) from one database to another database



during migration





Taking Script of Sql Server Jobs for Migration

when migration sql server database to a new server, i use the following powershell script to take al...