li.的博客
|
declare @id as nvarchar(36)
declare @ctime as datetime
declare @starttime datetime, --开始时间
@endtime datetime --结束时间
select @starttime='2009-05-01',
@endtime='2009-05-30'
declare @count int
set @count=1
while @count<=3
begin
set @id=replace(newid(),'-','')
select @ctime= dateadd(minute,convert(int,(rand()*datediff(minute,@starttime,@endtime))),@starttime)
print @ctime
set @count = @count + 1
end
--------------------------
update temp_t1 set addtime = dateadd(ss,abs(checksum(newid())%datediff(second,'2009-05-01','2009-05-30')), '2009-05-01')