• Unless there are some other surprises this should do it.

    Ive changed the definition for your table variable and im assuming that information is readily available to you.

    I would still recommend you to do a little reading on Tally tables - look for an article by Jeff Moden on this site.

    I find it a bit easier to work with an actual tally table rather than a dynamic one.

    IF object_id('TempDB..#tblSuperviosr') IS NOT NULL

    DROP TABLE #tblSuperviosr

    CREATE TABLE #tblSuperviosr(

    [PlanerID] [numeric](18, 0) IDENTITY(1,1) NOT NULL,

    [AdvisorID] [int] NOT NULL,

    [StartDate] [date] NULL,

    [StartTime] [time](7) NULL,

    [EndTime] [time](7) NULL,

    [Flag] [bit] NULL,

    CONSTRAINT [PK_tblSuperviosr] PRIMARY KEY CLUSTERED

    (

    [PlanerID] ASC

    ))

    DECLARE @t TABLE

    (AdvisorId INT, StartDate datetime, StartTime TIME, EndTime TIME, flag bit)

    INSERT INTO @t

    SELECT 1, '2012-01-01 00:00:00', '14:30', '16:30', 0

    ;WITH Tally (n) AS (

    SELECT TOP 100 15*(ROW_NUMBER() OVER (ORDER BY (SELECT NULL))-1)

    FROM sys.all_columns)

    insert into #tblSuperviosr

    SELECT AdvisorId, startdate,

    TSStart=DATEADD(minute, n, StartTime)

    ,TSEnd=DATEADD(minute, n + 15, StartTime)

    ,flag

    FROM @t

    CROSS APPLY (

    SELECT n

    FROM Tally

    WHERE n BETWEEN 0 AND DATEDIFF(minute, StartTime, DATEADD(minute, -15, EndTime))) a

    ORDER BY AdvisorId, StartDate, TSStart

    select *

    from #tblSuperviosr