declare @tta datetime, @i int set @tta='2013-1-10 00:00:00' set @i=0 while @tta < '2013-2-11 00:00:00'
begin
--select DATEADD(HH,1, @tta)
-- select top 1 * From tibet where "通话时间">@tta and "通话时间"< DATEADD(HH,1,@tta) order by "通话时间"
insert into tibackup select top 1 * From qqt where "通话时间">@tta and "通话时间"< DATEADD(HH,1,@tta) order by NEWID() ;
set @tta=DATEADD(HH, 1,@tta)
set @i = @i+1
end