×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: T-SQL
Posted by: Francesco Ceci
Added: May 27, 2014 9:44 AM
Views: 14
Tags: no tags
  1. Method 1 : Generate Random Numbers (Int) between Rang
  2. ---- Create the variables for the random number generation
  3. DECLARE @Random INT;
  4. DECLARE @Upper INT;
  5. DECLARE @Lower INT
  6.  
  7. ---- This will create a random number between 1 and 999
  8. SET @Lower = 1 ---- The lowest random number
  9. SET @Upper = 999 ---- The highest random number
  10. SELECT @Random = ROUND(((@Upper - @Lower -1) * RAND() + @Lower), 0)
  11. SELECT @Random