Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2010-02-04 : 07:21:07
|
| In sql, how do I get the status of a job to see if it has failed or not?I think there is a table somewhere which holds this information?Thanks |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-02-04 : 07:31:44
|
| Query on msdb..sysjobhistory tableMadhivananFailing to plan is Planning to fail |
 |
|
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2010-02-04 : 07:42:34
|
| I found this query as you see below...How do i check just the status of the job ?There should be just one line.The reason I am doing this is to find out if the ssis package has finished succesfully or not. The ssis package is run by a job.Select* Frommsdb..sysjobhistory as sysjobhistory Join msdb..sysjobs as sysjobs on sysjobhistory.job_id=sysjobhistory.job_idWhereName='jobname'andstep_name = 'jobname'OrderBy Run_DateDesc, run_timeDesc |
 |
|
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2010-02-04 : 07:46:31
|
| May be I should look for the max run_date?If so how do i max that because it is in string format.I tried convert(smalldatetime, run_date) but fails.Thanks |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-02-04 : 07:54:26
|
| Make use of dateadd(second,run_time,cast(run_date as char(8)))MadhivananFailing to plan is Planning to fail |
 |
|
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2010-02-04 : 12:40:44
|
| thanks again |
 |
|
|
|
|
|