Script all the jobs in SQL Server

Tuesday, May 22, 2012

This is very interesting fact that people always look for shortcuts especially while accomplishing the big tasks.

Here i have came up with a scenario: I have got a task to setup a new server B (lets assume) exactly as a replica of Existing Server A.

It involve a lot of steps in which there is a step to copy all the EXISTING JOBS FROM SERVER A to SERVER B (Please note i have written All the Jobs).

 Here is a easiest way i have found which might be helpful for many people.

Step1: Enable Object explorer detail.

Step2:
In SQL Server 2005 or earlier:  goto view->Summary
In SQL Server 2008 or older:  goto view-> Object Explorer Details

Step3:
Expand SQL Server Agent and click on Jobs.

All the jobs will be visible in summary/Object Explorer Detail window. (See Screenshot).





Step4:

Here you can select all the jobs or the desired jobs which you want to script out.

After select right click -> Script Job As -> Create To -> and select the desired location where you want to script all the selected jobs (In the screenshot i have selected New Query Editor Window).




Note: The above screenshots/Examples are of SQL Server 2008R2 you can follow the same steps with SQL Server 2005 or earlier versions.


I hope this will be helpful for may people out there :)



Related Posts Plugin for WordPress, Blogger...

0 comments:

 
© Copyright 2010-2012 Learn MySQL All Rights Reserved.
Template powered by Blogger.com.