Import SQL Agents jobs

Hi,

We have moved som databases from 2008 R2 to SQL Server 2014 and that was ok. Another thing im not sure how to solve is the jobs under SQL Server Agent>Jobs. What I have done now, I have right click the each job and selected "Script Job As>DROP To>File" and saved these as *.SQL files. But how do i import these to the new SQL Server 2014, so that they are listed under SQL Server Agent>Jobs ?

Because I can double click the *.SQL files, but not sure how to save these under SQL Jobs ?

Thanks for answers, SQL ne

May 26th, 2015 4:11pm

Hi Andreas

When you right-click on your original job choose 'Script job as' -> 'Create to' -> File  (note, don't choose DROP TO here)

Then open a connection to your target server with SQL Server Management Studio, open the file (file->open) and hit the execute button (or hit F5). This will execute the script and create the new job.

To see the job just Expand 'SQL Server Agent' -> 'Jobs'. You might have to right-click on Jobs and choose refresh before it appears.

Hope that helps.
  • Marked as answer by Andreas2012 10 hours 25 minutes ago
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2015 4:21pm

Hi,

Thanks for reply.

If I hit the execute button I guess the script will execute right away, but If I dont want to run the script now, is there a way to just import it for later, or do I just have to click the *.SQL file when I want the script to run ?

May 26th, 2015 4:27pm

Hi Andreas

Yes executing the script will create the job immediately. So you can save the files and just run them when you want the jobs to be created. 

There are alternatives, such as creating the jobs in a disabled state, however it's easier to just run the scripts when you need them.

Free Windows Admin Tool Kit Click here and download it now
May 26th, 2015 4:31pm

one additional point is make sure you have the operators and any other dependencies created on the new server before you run the jobs. else if you create the jobs and the server does not have those operators, it will fail or you will see errors.

you can go ahead create those operators and database mailprofile etc before hand and then execute the job creation and it should go smoothly...

I like to use powershellscripts to import the

May 26th, 2015 4:38pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics