Using the following screenshot to show an example of the data set,
int,datetime2,datetime2, int
How can i return all the free periods of time which are available within the start and stop ranges which are also equal or longer than the slot duration parameter when they are not stored in the database as appointments
declare @startRange datetime2
declare @endRange datetime2
declare @slotDurationInMinutes int
set @startRange = '2016-06-06T22:00:00.000Z'
set @endRange = '2016-06-07T21:59:00.000Z'
set @slotDurationInMinutes = 30
-- from this appointment dataset how do i query for all the free periods which are as long or longer than the slotduration parameter
-- these values are not stored in the table?
select TSO_Table_ID, time_start, time_end, duration from Org_TSO_Table
For example the expected output of a query where the slotduration param is 30 minutes would be:
free_from=2016-06-06T22:00:00.000Z free_until=2016-06-06T22:00:30.000Z
(This record contains the search range start value)
free_from=2016-06-06T22:01:30.000Z free_until=2016-06-06T22:04:00.000Z
free_from=2016-06-06T22:04:20.000Z free_until=2016-06-06T22:10:00.000Z
free_from=2016-06-06T22:11:00.000Z free_until=2016-06-06T22:11:30.000Z
free_from=2016-06-06T22:12:30.000Z free_until=2016-06-07T21:59:00.000Z
(This record contains the search range end value)