Table frequency metric Count (minimum 2 hits every 5 seconds using a datestamp within 24 hours) I need to find out how many times a table has an insert within a 24 hour period per 5 seconds, if the table is inserted at least twice (2x) or more for each 5 seconds of the day, it should be counted. So for every 5 seconds (using a datestamp), how many times was the table inserted at least 2x  within a 24 hour period per 5 seconds.  The max the count can be 17280, and that's only if there was 2 or inserts for each 5 seconds.
Since your day is divided into 5-second buckets, you'll need to do the same to your timestamp in the table.  Since you're counting the 5-second buckets and not the actual number of updates, you'll need to use either a CTE or derived table.  I'll use the CTE only because I think it's easier to read.

WITH UpdateIntervals AS (
  SELECT 
      DATEADD(SECOND, ROUND(DATEPART(SECOND, UpdateTimestamp)/5, 0)*5, 
        DATEADD(MINUTE, DATEDIFF(MINUTE, 0, UpdateTimestamp), 0)) AS Interval,
      COUNT(*) AS UpdateCount
  FROM dbo.YourTable
  WHERE UpdateTimestamp BETWEEN @ReportStartTime AND @ReportStopTime
  GROUP BY DATEADD(SECOND, ROUND(DATEPART(SECOND, UpdateTimestamp)/5, 0)*5, 
           DATEADD(MINUTE, DATEDIFF(MINUTE, 0, UpdateTimestamp), 0))
)
SELECT COUNT(*)
FROM UpdateIntervals
WHERE UpdateCount &gt;= 2;


You could just as easily use HAVING COUNT(*) &gt; 1 inside the CTE and then a simple COUNT(*) in the query with no where condition, but to me, this makes it clear what I intended to do when I come back and read this 6 months later.  I'm counting the number of updates per interval, then counting intervals with at least 2 updates.

The nasty-looking DATEADD formula isn't as bad as it looks.  First, it truncates your update timestamp down to the minutes level by calculating the number of minutes between 0-time and your timestamp, then adding them back to 0-time.  The seconds part of your timestamp is then rounded down to the previous multiple of 5, and the rounded value added back to the timestamp to give you 5-second buckets.