declare @StartDate smalldatetime, @EndDate smalldatetime
set @StartDate = '2013-12-30'
set @EndDate = '2014-02-02'
select dateadd(day,number+1,@StartDate) as DateId
from master..spt_values
where type = 'P' and dateadd(day,number+1,@StartDate) < @EndDate
Output :
DateId
2013-12-31 00:00:00
2014-01-01 00:00:00
2014-01-02 00:00:00
2014-01-03 00:00:00
2014-01-04 00:00:00
2014-01-05 00:00:00
2014-01-06 00:00:00
2014-01-07 00:00:00
2014-01-08 00:00:00
2014-01-09 00:00:00
2014-01-10 00:00:00
2014-01-11 00:00:00
2014-01-12 00:00:00
2014-01-13 00:00:00
2014-01-14...