Solved

check sql job status if completed

Posted on 2008-10-16
2
1,953 Views
Last Modified: 2013-11-30
I have a sql job that is executed via stored procedure...

how to i check if the execution of the sql job has been completed, coz i need to update data on the table where the sql job inserted data...

some code snippet for validation would help a lot.. thanks...
0
Comment
Question by:praetorean
2 Comments
 
LVL 7

Assisted Solution

by:Chandan_Gowda
Chandan_Gowda earned 50 total points
Comment Utility
Please try the below query
Select 

 * 

From  

 msdb..sysjobhistory  as sysjobhistory

   Join  msdb..sysjobs as sysjobs on sysjobhistory.job_id=sysjobhistory.job_id

Where 

 Name='JOB_Name'

Order By 

 Run_Date Desc, 

 run_time Desc

Open in new window

0
 

Accepted Solution

by:
praetorean earned 0 total points
Comment Utility
Hi Chandan_Gowda,

i got the code to work... i got a large result set to show me the status of the jobs... i was hoping for a single resultset to validate for the status of the sql job... the flow is as follows:

1- app invokes a stored procedure
2- store procedure executes a sql job
3- after the execution of the sql job; would like to validate if execution has been completed and successfull
4- if validation on item # 3 = true; update certain columns of the table...

thanks in advance...
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

763 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

5 Experts available now in Live!

Get 1:1 Help Now