====== Statistische Verteilung der Nachrichten über der Zeit ======
Folgende SQL Statements werten die Verteilung der Nachrichteneingänge über der Zeit aus und geben somit Aufschuss über die Zeiten größter Auslastung.
===== pro Stunde =====
SELECT DATEPART(hour,EntryDate) AS OnHour,
COUNT(*) AS Totals
FROM [eBiss3].[dbo].[Message]
GROUP BY DATEPART(hour,EntryDate)
order by OnHour asc
===== pro Tag und Stunde =====
SELECT CAST(EntryDate as date) AS ForDate,
DATEPART(hour,EntryDate) AS OnHour,
COUNT(*) AS Totals
FROM [eBiss3].[dbo].[Message]
GROUP BY CAST(EntryDate as date),
DATEPART(hour,EntryDate)
===== pro Stunde mit Prozent und Balkendiagramm =====
DECLARE @TotalMessages INT;
SET @TotalMessages = select COUNT(*)from [eBiss3].[dbo].[Message];
SELECT
DATEPART(hour,EntryDate) AS OnHour,
COUNT(*) AS Totals,
CAST(round(COUNT(*) * 100.0 /@TotalMessages, 1) as decimal(5,1)) as Percentage,
REPLICATE ( '*' , COUNT(*) * 100.0 /@TotalMessages) as BarGraph
FROM [eBiss3].[dbo].[Message]
GROUP BY
DATEPART(hour,EntryDate)
order by OnHour asc