rand2

Description

Returns a random value between 0 and 1, which is generated using the specified seed value, and computed for each returned row when used in the select list.

Syntax

rand2([integer])

Parameters

integer

is any integer (tinyint, smallint, or int) column name, variable, constant expression, or a combination of these.

Examples

Example 1

If there are n rows is table t, the following select statement returns n different random values, not just one.

select rand2() from t
------------

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute rand.

See also

Datatypes Approximate numeric datatypes