(一)
declare @begin_date as smalldatetime select @begin_date = '07/27/2006 00:00:00'
declare @i as int select @i=0
while dateadd(hh,@i,@begin_date) < '07/27/2006 12:00:00'
begin
select @i as code,dateadd(hh,@i,@begin_date) as jdate
set @i=@i+1
end
(二)
declare @begin_date smalldatetime select @begin_date = '07/27/2006 00:00:00'
declare @i int select @i=0
while dateadd(n,@i,@begin_date) < getdate()
begin
select @i,dateadd(n,@i,@begin_date) jdate
set @i=@i+30
end
declare @begin_date as smalldatetime select @begin_date = '07/27/2006 00:00:00'
declare @i as int select @i=0
while dateadd(hh,@i,@begin_date) < '07/27/2006 12:00:00'
begin
select @i as code,dateadd(hh,@i,@begin_date) as jdate
set @i=@i+1
end
(二)
declare @begin_date smalldatetime select @begin_date = '07/27/2006 00:00:00'
declare @i int select @i=0
while dateadd(n,@i,@begin_date) < getdate()
begin
select @i,dateadd(n,@i,@begin_date) jdate
set @i=@i+30
end