declare
@startdate varchar(30)declare
@enddate varchar(30)Declare
@init intDeclare
@count intselect
@startdate='2013-01-18 00:00:00.000',@enddate='2013-01-25 00:00:00.000',@init=0select
@count=DATEDIFF(day,@startdate,@enddate)if
OBJECT_ID('#tab')>0drop
table #tabcreate
table #tab(sno int identity(1,1),[date] datetime)while
@init<=@countbegin
insert
into #tab([date])select
dateadd(day,@init,@startdate)select
@init=@init+1end
select
* from #tab
No comments:
Post a Comment