declare @M int,@N int set @m=10 set @n=1 select top 10 cast(rand(checksum(newid()))*(@M-@N)+@n as int) from t_table