Returns a random float value between 0 and 1.
RAND([seed])
float
This example uses a variable to produce five different random numbers generated with the RAND function.
DECLARE @counter smallint
SET @counter = 1
WHILE @counter < 5
BEGIN
SELECT RAND(@counter)
SET NOCOUNT ON
SET @counter = @counter + 1
SET NOCOUNT OFF
END
GO
Here is the result set:
(1 row(s) affected)
------------------------
0.00125125888851588
(1 row(s) affected)
------------------------
0.00137333292641987
(1 row(s) affected)
------------------------
0.00146488845484787
(1 row(s) affected)
------------------------
0.00155644398327586
(1 row(s) affected)