Retrieving days from a date range

I have a date range from
"1/27/2014" - launch
"1/31/2014" - end

Note:

Figure 1 is the data from SQL
. Figure 2 is the way I want the data to be retrieved

How to do this with an SQL query?
Is it possible?

+3
source share
1 answer
DECLARE @startDate DATE
DECLARE @endDate DATE
SET @startDate = '1/27/2014'
SET @endDate = '1/31/2014'
;WITH dates AS 
(
    SELECT @startdate as Date 
    UNION ALL
    SELECT DATEADD(d,1,[Date])
    FROM dates 
    WHERE DATE < @enddate
)
SELECT Date from dates

Watch live

+2
source

All Articles