Solved

check sql job status if completed

Posted on 2008-10-16
2
1,993 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
[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
2 Comments
 
LVL 7

Assisted Solution

by:Chandan_Gowda
Chandan_Gowda earned 50 total points
ID: 22738641
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
ID: 22754997
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
I have a large data set and a SSIS package. How can I load this file in multi threading?
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how the fundamental information of how to create a table.

734 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