日期:2014-05-17 浏览次数:20596 次
Create function [dbo].[generateTime]
(
@begin_date datetime,
@end_date datetime
)
returns @t table(date datetime)
as
begin
with maco as
(
select @begin_date AS date
union all
select maco.date+1 as date from maco
where date+1 <=@end_date
)
insert into @t
select * from maco option(maxrecursion 0);
return
end
go
select * from dbo.generateTime('2013-2-1','2013-2-28')