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 to recreate scheduled jobs

Author  Topic 

mherfkens
Starting Member

8 Posts

Posted - 2004-02-17 : 18:36:52
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

38200 Posts

Posted - 2004-02-17 : 18:39:13
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 - 2004-02-17 : 18:45:44
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

38200 Posts

Posted - 2004-02-17 : 18:52:38
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 - 2004-02-17 : 18:56:50
Oh, I get it now, I feel stupid... thanks for the explanation
Go to Top of Page
   

- Advertisement -