I want to write a procedure in TSQL that calculates peak times between given date ranges that splitted to time given.
Start time: 10-02-2012 10:00
End time : 10-02 2012 11:00
time range: every 5 minutes
so it will be:
10:00 range 1 -> 5 peak times
10:05 range 2 -> 11 peak times
.
.
.
11:00 range 11 -> 7 peak times
when time range given 30 min then the code will calculate 2 ranges
Should I use Interval? How can i solve this problem? Any Help?
You can determine the time ranges thusly:
Join the ranges with your sample data to obtain the summary: