Friday, February 12, 2010

Random Number Generator

---- Create the variables for the random number generation
DECLARE @Random INT ;
DECLARE @Upper INT ;
DECLARE @Lower INT

---- This will create a random number between 1 and 999
SET @Lower = 1
---- The lowest random number
SET @Upper = 999
---- The highest random number
SELECT  @Random = ROUND(( ( @Upper - @Lower ) * RAND() + @Lower ), 0)
SELECT  @Random