Number of alerts raised per day for last 28 days
/*Number of alerts raised per day for last 28 days.*/
USE OperationsManagerDW
SELECT CONVERT(VARCHAR(10), DBCreatedDateTime, 101) AS Date, COUNT(*) AS Alerts
FROM Alert.vAlert
WHERE (DBCreatedDateTime BETWEEN DATEADD(day, -27, GETDATE()) AND GETDATE())
GROUP BY CONVERT(VARCHAR(10), DBCreatedDateTime, 101)
ORDER BY Date DESC
Comments
Anonymous
January 01, 2003
Hi Lisa, No problem. Just replace the WHERE clause in the above statement from: WHERE (DBCreatedDateTime BETWEEN DATEADD(day, -27, GETDATE()) AND GETDATE()) To: WHERE (CONVERT(VARCHAR(10), DBCreatedDateTime, 101) BETWEEN 'DD/MM/YYYY' and 'DD/MM/YYYY') Just plug in your date range. -JonathanAnonymous
December 02, 2009
Hi, Jonathan Do you know how to specify the data range instead of the last 28 days? for example from Nov 1 to Nov. 28