Solved

SQL Server Jobs

Posted on 2009-05-20
1
213 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
index  - last use and update 8 58
Another way of doing this SQL 8 46
SQL Date from a string 4 58
Truncate vs Delete 63 102
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

28 Experts available now in Live!

Get 1:1 Help Now