Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Script Library
 Script out ALL jobs in SQL Server 2005

Author  Topic 

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2008-01-04 : 14:08:53

Will prbly write a blog about this pretty soon. Until then, here is a quick llist of steps:

Create an IS package from Visual Studio. In the Toolbox, under the "Control Flow Items" there is a "Transfer Jobs Task". Use this to transfer jobs to your local machine or any other server.

I still have to figure out how to make it write to a flat file. The only destination it allows at this point seems to be another SQL server.




Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-01-04 : 14:15:56
this can easily be done with SMO:

http://technet.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.agent.job.script.aspx


elsasoft.org
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2008-01-04 : 14:34:40
quote:
Originally posted by jezemine

this can easily be done with SMO:

http://technet.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.agent.job.script.aspx


elsasoft.org



I cant write .NET code..

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-01-04 : 15:05:32
time to learn then. free yourself from the shackles of T-SQL!


elsasoft.org
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2008-01-04 : 15:20:17
Scripting out objects is the most basic common thing for a DBA or even a developer.

What next.. no SSMS? We have to write code simulate that?

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-01-04 : 15:57:32
you can script a job from SSMS if you like to point and click. to do it in an automated way you have to use SMO, combined with powershell for example, or some other method, such as your SSIS task. SSIS makes me gag though.




elsasoft.org
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2008-01-04 : 16:04:08
quote:
Originally posted by dinakar
Scripting out objects is the most basic common thing for a DBA or even a developer.

What next.. no SSMS? We have to write code simulate that?...

Maybe they are making it more like Oracle.

SQL Server 2000 Enterprise Manager let you script out all jobs, but to only a single file.

I wonder if that feature is available in the SQL Server 2008 tools?





CODO ERGO SUM
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2008-01-04 : 16:27:03
I found that you can script out all jobs from Management Studio.

1. Open the server in the Object Explorer.
2. Open the "Object Explorer Details" window.
3. In the "Object Explorer Details" window, drill down to "SQL Server Agent"
4. Drill down to "Jobs"
5. Select the jobs you want to script.
6. Right click and select "Script Job as", then "Create To", and select where you want them scripted to.





CODO ERGO SUM
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2008-01-04 : 16:58:56
quote:
Originally posted by Michael Valentine Jones

I found that you can script out all jobs from Management Studio.

1. Open the server in the Object Explorer.
2. Open the "Object Explorer Details" window.
3. In the "Object Explorer Details" window, drill down to "SQL Server Agent"
4. Drill down to "Jobs"
5. Select the jobs you want to script.
6. Right click and select "Script Job as", then "Create To", and select where you want them scripted to.





CODO ERGO SUM



You got it.. While I was googling I found someone mentioned hit F7 key after selecting the Jobs folder, it will bring up the summary pane and from there select the jobs you want and right click - >Script. Perhaps this is what they were referring to.

Good to know. Thanks MVJ.

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-01-04 : 18:10:37
bah. you and your gui!




elsasoft.org
Go to Top of Page

xyvyx
Starting Member

6 Posts

Posted - 2008-10-16 : 11:34:12
wow, i'd generally written off the detail pane as useless... bah!
Why is it not in a Tasks menu when you select the Jobs folder from the nav pane?



"If we can put it into a table, we can kill it"
-Ahnold Sequelnator
Go to Top of Page
   

- Advertisement -