RAND (Transact-SQL)
Returns a pseudo-random float value from 0 through 1, exclusive.
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()
Update X set X.a = Rand()
Will write the same value for all X.a (Rand is only executed once per statement)
An alternative is to use an integer seed derived from the data
Update X set X.a = Rand(X.AnIntVal)
Also
Select X.a from X order by Rand()
Will not order data randomly
An alternative is to use NewID(). I've found this slow on large datasets (Please post alternatives here)
Select X.a from X order by NewID()
These are quick and dirty solutions. For a more complete solution see http://msdn.microsoft.com/en-us/library/aa175776(SQL.80).aspx for random sampling.
