worker bee (1/11/2012)
Okay, I have to add a convert for the UTC column and I have no idea where to put it, can some one help me out real quick?add convert UTCdatetime to yyyy/mm/dd in sql statement
SELECT ServerName, COUNT(ServerName) AS [Count], Value, Heading, UTCOccurrenceDateTime
FROM Alerts
WHERE (Heading LIKE 'Disk %') AND (Heading NOT LIKE 'Disk C%') AND (Value >= 95.00)
AND DATEADD(hh, -6, UTCOccurrenceDateTime) >= DATEADD(day, DATEDIFF(day, 0, GETUTCDATE()), 0)
GROUP BY Heading, Value, ServerName, UTCOccurrenceDateTime
HAVING (COUNT(ServerName) < 2500000)
ORDER BY UTCOccurrenceDateTime, ServerName
SELECT ServerName,
COUNT(ServerName) AS [Count],
Value,
Heading,
REPLACE(CAST(UTCOccurrenceDateTime as date),'-','/')
--or try SELECT CONVERT(VARCHAR(10), UTCOccurrenceDateTime, 111)
--or try SELECT CONVERT(DATE, UTCOccurrenceDateTime, 111)
FROM Alerts
WHERE (Heading LIKE 'Disk %') AND (Heading NOT LIKE 'Disk C%') AND (Value >= 95.00)
AND DATEADD(hh, -6, UTCOccurrenceDateTime) >= DATEADD(day, DATEDIFF(day, 0, GETUTCDATE()), 0)
GROUP BY Heading, Value, ServerName, UTCOccurrenceDateTime
HAVING (COUNT(ServerName) < 2500000)
for helpful date conversions: Try this
also see: datetime
Stephen