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

posted @ 2014-11-06 14:31  xueshui20  阅读(257)  评论(0编辑  收藏  举报