Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

Come inserire 1000 date casuali tra un determinato intervallo?

declare @FromDate date = '2011-01-01'
declare @ToDate date = '2011-12-31'

select dateadd(day, 
               rand(checksum(newid()))*(1+datediff(day, @FromDate, @ToDate)), 
               @FromDate)