Solved

SQL Server Jobs

Posted on 2009-05-20
1
212 Views
Last Modified: 2012-05-07
Hi All,

I have two jobs job1 one server1 and job2 on server2. Both are running fine but I want to setup one job so that once the job1 on server1 is done, job2 on server2 is the next step and if everything failes I send an email saying one of the step has failed.

Thanks in advance for your help.

Cheers.
0
Comment
Question by:matrix_aash
1 Comment
 
LVL 8

Accepted Solution

by:
tpi007 earned 500 total points
ID: 24430001
You can do following:
  • Database Mail set up on both servers
  • Add linked server on server1 to server2
  • Add last step on server1 job as following
    • EXEC [server2].msdb.dbo.sp_start_job N'YourJobName'
    • Should have notification for email attched to job for 'When Job Completes' for info on server1 job
  • Add notification email to job on server2 as for 'When Job Completes'
    • Will provide info on server2 job  
I always have mail alerts set for when job completes so that you do not assume everything is good if your email system fails.
 

--Assumes your linked server name is server2

-- Replace 'YourJobName'  with valid job name

EXEC [server2].msdb.dbo.sp_start_job N'YourJobName' 

Open in new window

0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now