RANDOM_DATE (TSQL Function)

Returns a random date between the two dates passed as arguments, inclusively.

Syntax

RANDOM_DATE ( startdate , enddate )

Arguments

startdate
is the start date, of type date. It must be a constant literal.
enddate
is the end date, of type date. It must be a constant literal.

Return Types

Returns date.

Remarks

The returned date is uniformly distributed.

This function doesn’t exist in MS SQL Server.

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

Examples

See RANDOM_VARCHAR and RANDOM_NUMERIC.