日期:2014-05-17 浏览次数:20566 次
declare @stime SMALLDATETIME
declare @etime SMALLDATETIME
set @stime = '2000-01-01 00:00:00'
declare @i INT
set @i=0
SET @etime=dateadd(n,@i,@stime)
DECLARE @tb TABLE(c1 DATETIME )
while @etime < getdate()
BEGIN
INSERT INTO @tb
select TOP 1 crdate FROM sysobjects WHERE crdate BETWEEN @stime AND @etime ORDER BY(NEWID())
set @i=@i+10
SET @stime=@etime
SET @etime=dateadd(n,@i,@stime)
end
SELECT * FROM @tb
--sysobjects 换成你自己表,@tb根据需要进行定义