Solved

SQL Server Jobs

Posted on 2009-05-20
1
217 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Merige returns error code when updating 15 60
Following an example - removing duplicate strings 4 70
Loops and updating in SQL Query 9 72
SQL query 7 50
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…

710 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