Hi Ivan,
I am not 100% clear what you are trying to do, but if we look at the problem of "log entries per second" this can be achieved with:
select
min(Timestamp) as Time,
count(*)
from CV
group by
datepart(year, Timestamp),
datepart(month, Timestamp),
datepart(week, Timestamp),
datepart(day, Timestamp),
datepart(hour, Timestamp),
datepart(minute, Timestamp),
datepart(second, Timestamp)
order by Time
This SQL statement will group all log entries by time down to the nearest second of granularity, count the number of entries during the interval, and find the minimum timestamp.
The built in 'Log Entries Per Minute' query does something similar by focusing on the minute interval. It does this very differently (and somewhat hacky) by casting the Timestamp to a small date time:
CAST(Timestamp AS smalldatetime)
The SmallDateTime data type does not support granularity less than a minute.
Does that help the SQL you were trying to write? If not, can you give me more detail on what you are trying to do?
Hope that helps,
Toby