使用sql查询生成开始到结束日期之间的所有日期
利用select * from master.dbo.spt_values
declare @StartDate DATETIME = '2015/05/01'
declare @EndDate DATETIME ='2015/06/03'
select dateadd(day,number,@StartDate) as dt
from master.dbo.spt_values where type ='P'
and number <=DATEDIFF(day, @StartDate, @EndDate)
/*
dt
-----------------------
2015-05-01 00:00:00.000
2015-05-02 00:00:00.000
2015-05-03 00:00:00.000
2015-05-04 00:00:00.000
2015-05-05 00:00:00.000
2015-05-06 00:00:00.000
2015-05-07 00:00:00.000
2015-05-08 00:00:00.000
...
*/