Random sequence in Transact SQL query
The rand()
Transact SQL function produces a sequence of same numbers in the query. For example:
SELECT rand() AS rand_value, id
FROM
( SELECT 1 AS id
UNION SELECT 2 AS id
UNION SELECT 3 AS id
) AS t1;
This query shows the following result:
rand_value id
---------------------- -----------
0,581556027773794 1
0 …