• You need some form of Tally table (or Numbers table). These can be permanent tables or can be generated on the fly. The Tally table I'm using below has the following structure:

    CREATE TABLE dbo.Tally (

    N int NOT NULL PRIMARY KEY CLUSTERED

    )

    There's plenty of information on Tally tables elsewhere on this site. Here's the T-SQL to return the list of sequential dates. In this case, the Tally table must contain the sequential integers between 0 and the maximum number of rows you are ever likely to require.

    DECLARE @startDate datetime

    DECLARE @endDate datetime

    SELECT @startDate = '20090215', @endDate = '20090219'

    SELECT DATEADD(day, T.N, @StartDate) AS [Date]

    FROM dbo.Tally T

    WHERE (T.N >= 0 AND T.N <= DATEDIFF(day, @startDate, @endDate))

    ORDER BY T.N