Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Tuesday, May 26, 2015 8:10 PM
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 newbi :)
/Regards Andreas
Tuesday, May 26, 2015 8:20 PM ✅Answered | 2 votes
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.
Tuesday, May 26, 2015 8:25 PM
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 ?
/Regards Andreas
Tuesday, May 26, 2015 8:30 PM | 1 vote
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.
Tuesday, May 26, 2015 8:36 PM | 1 vote
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 jobs.
Hope it Helps!!