Home > DeveloperSection > Interviews > how to use function to generate rand number in mssql server?

Posted on    November-09-2010 12:00 AM

 MSSQL Server MSSQL Server 
Ratings:
 1 Answer(s)
  1691  View(s)
Rate this:

Amit Singh

Total Post:565

Points:2825
Posted on    November-09-2010 1:00 AM

we use rand function in sql server to generate random number

* RAND(seed) - Starting a new sequence of random numbers based on the given integer "seed" and returning the first random number in FLOAT(53) from the sequence.
* RAND() - Returning the next random number in FLOAT(53) from the current sequence. If there has been no current sequence, SQL Server will start a new sequence with a random "seed".

for example:
SELECT RAND(100);

Don't want to miss updates? Please click the below button!

Follow MindStick