• Hi Dwain, I came up with this last night but ran out of time to post;

    ;WITH WholeRange AS (

    SELECT datecol = DATEADD(day,n,d.Startdate)

    FROM (SELECT Startdate = MIN(datecol), daysSpan = 1+DATEDIFF(day,MIN(datecol), MAX(datecol)) FROM #SAMPLETABLE) d

    CROSS APPLY (SELECT TOP(daysSpan) n = ROW_NUMBER() OVER (ORDER BY (SELECT NULL))-1 FROM sys.columns a, sys.columns b) x

    )

    SELECT * --left like this for testing

    FROM WholeRange w

    CROSS APPLY (

    SELECT TOP 1 s.*

    FROM #SAMPLETABLE s

    WHERE s.datecol <= w.datecol

    ORDER BY s.datecol DESC

    ) x

    You'll notice it's exactly the same as Nagaram's query - except for the number generator.

    I can't find anything wrong with it?

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden