SDU Tools: Time Periods Between in SQL Server T-SQL
As part of our free SDU Tools for developers and DBAs, we have a function that generates dimension columns for individual time periods. To make that easy to use across a range of times in day, we’ve added a function called TimePeriodsBetween.
It’s a table-valued function that takes three parameters:
@StartTime time is the first time to return @EndTime is the last time to be returned @MinutesPerPeriod is the number of minutes in each time period for the day (e.g. it’s 15 for every quarter of an hour)
2020-01-22