example :
INPUT :
column1 column2
10:00am 11:00am
I have to get like the below output
OUTPUT:
column1 column2
10:00am 10:15am
10:16am 10:20am
10:21am 10:30am
10:31am 10:40am
10:41am 10:50am
10:51am 11:00am
example :
INPUT :
column1 column2
10:00am 11:00am
I have to get like the below output
OUTPUT:
column1 column2
10:00am 10:15am
10:16am 10:20am
10:21am 10:30am
10:31am 10:40am
10:41am 10:50am
10:51am 11:00am
Your expected output is not all clear...
Your first intervall is 15 minutes, the rest is 10 minutes.
You can try it like this (which is strictly 10 minutes - SQL Server syntax):
DECLARE @Start TIME='10:00';
DECLARE @End TIME='11:30';
DECLARE @minuteIncrement INT=10;
WITH Tally AS
(
SELECT TOP ((DATEDIFF(MINUTE,CAST(@Start AS DATETIME),CAST(@End AS DATETIME)))/@minuteIncrement) (ROW_NUMBER() OVER(ORDER BY (SELECT NULL))-1) * @minuteIncrement AS Nr
FROM master..spt_values
)
SELECT CAST(DATEADD(MINUTE,Nr+1,@Start) AS TIME) AS column1
,CAST(DATEADD(MINUTE,Nr+@minuteIncrement,@Start) AS TIME) AS column2
FROM Tally;
If you really need the first intervall differently, you'll have to start the calculated value with the first strict intervall and add the first step with UNION ALL
...