SQL Server/T-SQL Tutorial/Math Functions/RAND
Содержание
RAND Generates a random number between 0 and 1, which is returned as a float.
4> SELECT RAND()
5> GO
------------------------
0.16134333864034361
(1 rows affected)
RAND Returns random number from 0 to 1.
4>
5>
6> select CEILING(RAND()*100)
7> GO
------------------------
51
(1 rows affected)
1>
select RAND()
3> select RAND()
4> GO
------------------------
0.28235054506303059
(1 rows affected)
1>
SELECT RAND(22) Result
3>
4> SELECT RAND(22) Result
5> GO
Result
------------------------
0.71398328560934576
(1 rows affected)