• That should be fine.

    Try this. Just uncomment the insert into statement and replace with your actual table

    declare @studentid as datetime = '2012-01-03 00:00:00'

    declare @studentname as varchar(20) = 'john'

    declare @startdate as datetime = '2012-01-03 00:00:00'

    declare @starttime as datetime = '2012-01-03 07:00:00'

    declare @endtime as datetime = '2012-01-03 09:00:00'

    --insert into tablename

    select @studentid, @studentname, @startdate, DATEADD(mi, (N-1)*15, @starttime), DATEADD(mi, N*15, @starttime)

    from Tally

    where n >= 1 and n <= datediff(mi, @starttime, @endtime)/15