Blog Banner

SQL Really Random Numbers

Ever try to get a random number in SQL, and then when you run your tests, the “random” number has these repetitive pattern?

For a really random number between 1 and 100, try this SQL:

Select RAND(Checksum(Newid())), Cast(100 * RAND(Checksum(Newid())) + 1 AS INT) AS Rnd

 

 


Posted

in

, ,

by

Tags:

%d bloggers like this: