首页 > 代码库 > SQL server指定随机数范围

SQL server指定随机数范围


declare @randnum int=0
declare @startnum int =0
declare @endnum int=0

set @startnum = 150

set @endnum = 200

set @randnum = ROUND(((@endnum - @startnum -1) * RAND() + @startnum), 0)
select @randnum

SQL server指定随机数范围