SQL中给定某一日期段生成所有日期数据

时间:2022-05-05 14:04:28
SELECT CONVERT(NVARCHAR(10), DateAdd(day,number,'2014-09-29'),120) AS GroupDay  
FROM master..spt_values  
WHERE type = 'p' AND number <= DateDiff(day,'2014-09-29','2014-10-29')  

GroupDay
2014-09-29
2014-09-30
2014-10-01
2014-10-02
2014-10-03
2014-10-04
2014-10-05
2014-10-06
2014-10-07
2014-10-08
2014-10-09
2014-10-10
2014-10-11
2014-10-12
2014-10-13
2014-10-14
2014-10-15
2014-10-16
2014-10-17
2014-10-18
2014-10-19
2014-10-20
2014-10-21
2014-10-22
2014-10-23
2014-10-24
2014-10-25
2014-10-26
2014-10-27
2014-10-28
2014-10-29