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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SQL query.

Author  Topic 

arvindrr
Starting Member

1 Post

Posted - 2010-04-22 : 20:56:53

I have a list of Batches that I need to monitor on a daily basis. I have written a SQL query to monitor these batches and check if the status flag is Success and the date run has been within last 24 hours...

When I run the query, I get a list of batches which has succeed from the list and with last 24 hrs. However, I need to know which ones have failed... out of the list
eg:- 'Emails Sent', 'Daily Sales Orders','Daily Delivery Schedule'


SELECT DISTINCT dbo.BatchJobs.Description
FROM dbo.BatchsRun INNER JOIN
dbo.BatchJobs ON dbo.BatchsRun.JobID = dbo.BatchJobs.JobID
WHERE dbo.BatchsRun.LstProcessedDt >= getdate()-1 and (StatusCode = '1' OR StatusCode = '0') and dbo.BatchJobs.Description IN (

'Emails Sent',
'Daily Sales Orders',
'Daily Delivery Schedule'
)

Thanks for your help.

-AR-

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-23 : 02:08:55
what will be value of status flag for failures?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -