RANDOM_INT (TSQL Function)

Returns a random int between the two values passed as arguments, inclusively.

Syntax

RANDOM_INT ( startval , endval )

Arguments

startval
is the start value, of type int. It must be a constant literal.
endval
is the end value, of type int. It must be a constant literal.

Return Types

Returns int.

Remarks

The returned value is uniformly distributed.

This function doesn’t exist in MS SQL Server.

You should use it to easily fill your test tables with random int values.

Examples

See RANDOM_VARCHAR and RANDOM_NUMERIC.

RSQL, a simple alternative to Microsoft SQL Server