DECLARE @days INT,@date_start DATETIME,@date_end DATETIME ;
set @date_start= '2018-07-29';
set @date_end= '2018-09-01' ;
SET @days = DATEDIFF(DAY, @date_start, @date_end);
select DATEADD(dd, number, @date_start) AS work_date
from master.dbo.spt_values
where type = 'p' and number <=DATEDIFF(DAY, @date_start,@date_end)
SQL server如何将时间段拆分为每天
最新推荐文章于 2022-04-26 10:38:33 发布