RAND (Transact-SQL)
SQL Server 2005
Returns a random float value from 0 through 1.
Transact-SQL Syntax Conventions
- seed
-
Is an integer expression (tinyint, smallint, or int) that gives the seed value. If seed is not specified, the Microsoft SQL Server 2005 Database Engine assigns a seed value at random. For a specified seed value, the result returned is always the same.
Repetitive calls of RAND() with the same seed value return the same results.
For one connection, if RAND() is called with a specified seed value, all subsequent calls of RAND() produce results based on the seeded RAND() call. For example, the following query will always return the same sequence of numbers.
SELECT RAND(100), RAND(), RAND()