【转】 SQL - 生成指定范围内的随机数
DECLARE @Result INT DECLARE @Upper INT DECLARE @Lower INT SET @Lower = 1 SET @Upper = 10 SELECT @Result = ROUND(((@Upper - @Lower -1) * RAND() + @Lower), 0) SELECT @Result
转自:https://www.cnblogs.com/Kymo/archive/2010/11/08/1871577.html