In this article we’ll learn the procedure that selects random number between the two numbers entered as parameters.
Create Procedure Sp_Random_Value
@result int output
Set @result =Floor(RAND() * (@second-@first))+@first
After getting succesful message we can run the below code to get random values. You can enter deferent values.
Declare @r int
Execute Sp_Random_Value 20,30,@r output
Each time you run the code, you will receive different values between 20 and 30.
I got the result : 23