SQL语句生成指定范围内随机数
1、生成随机实型数据
create procedure awf_RandDouble @min dec(14,2), @max dec(14,2), @result dec(14,2) output as begin set @result= cast((rand()*(@max-@min)+@min) as dec(14,2)) return @result end
2、生成随机整型数据
create procedure awf_RandInt @min int, @max int, @result int output as begin set @result= cast((rand()*(@max-@min)+@min) as int) return @result end