After using part 1 to get a list of the offending computer names, use part 2 to find out what all the noise is about. Don't forget to change 'YOURCOMPUTERNAMEHERE' to one of your computer names from part 1. Enjoy!
-- Alerts past 1 day Part 2
-- Scott Moss 10/03/07
-- OnePoint MOM 2005
-- Enter Computer name and get the alert details
-- for all alerts past 1 day with repeat count higher than 0.
Declare @Server varchar(30)
SET @Server = 'YOURCOMPUTERNAMEHERE' -- type a server name
SELECT ComputerName, [Name], COUNT(*) AS AlertCount
FROM SDKAlertView
WHERE RepeatCount > 0
and (DateDiff(D, TimeOfLastEvent, GetDate()) <= 1) AND ComputerName=@Server
GROUP BY [Name],ComputerName
ORDER BY AlertCount DESC
Woot
I'm finally caught up from being off work for 4 days two weeks ago. My wife and I were able to escape the children for a few days in the mountains for our 11th wedding anniversary and my 36th birthday. Now on with the SQL Query.
This query returns a per server count of alerts for the past day that has a repeat count higher than zero. (higher than zero, it happened more than one time and could possibly be a real problem.)
-- SQL CODE
-- Alerts past 1 day Part 1
-- Scott Moss 10/03/07
-- OnePoint DB MOM 2005
-- Count per computer the number of alerts with a repeat count greater than 0
-- and the TimeOfLastEvent the past 1 day.
SELECT [ComputerName], COUNT(*) AS AlertCount
FROM SDKAlertView
WHERE RepeatCount > 0
and (DateDiff(D, TimeOfLastEvent, GetDate()) <= 1)
GROUP BY ComputerName
ORDER BY AlertCount DESC