SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Script Library
 script to recreate scheduled jobs
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mherfkens
Starting Member

8 Posts

Posted - 02/17/2004 :  18:36:52  Show Profile  Visit mherfkens's Homepage  Reply with Quote
I am looking for a script to recreate scheduled jobs on new SQL Servers that I build. I am hoping to find one that will pull information from the system tables for the name of the server and the names of the databases so that it does not have to be extensively modified for each new server.

tkizer
Almighty SQL Goddess

USA
37129 Posts

Posted - 02/17/2004 :  18:39:13  Show Profile  Visit tkizer's Homepage  Reply with Quote
Right click on the jobs in Enterprise Manager, go to All Tasks, then go to Generate SQL Script.

Tara
Go to Top of Page

mherfkens
Starting Member

8 Posts

Posted - 02/17/2004 :  18:45:44  Show Profile  Visit mherfkens's Homepage  Reply with Quote
I've done that but it just give me a script that is specific to the server I generate it from. It still requires a lot of modification after that.
Go to Top of Page

tkizer
Almighty SQL Goddess

USA
37129 Posts

Posted - 02/17/2004 :  18:52:38  Show Profile  Visit tkizer's Homepage  Reply with Quote
It should not be specific to the server unless your job steps are doing something server specific or you are using multi-server administration. But perhaps you are talking about this part in the script:

-- Add the Target Servers
EXECUTE @ReturnCode = msdb.dbo.sp_add_jobserver @job_id = @JobID, @server_name = N'(local)'


If (local) says a server name in your script, you can change it to (local) so that it works no matter where you run the script.

Tara
Go to Top of Page

mherfkens
Starting Member

8 Posts

Posted - 02/17/2004 :  18:56:50  Show Profile  Visit mherfkens's Homepage  Reply with Quote
Oh, I get it now, I feel stupid... thanks for the explanation
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000