Skip to content
Jonathan Bairstow edited this page Sep 7, 2020 · 6 revisions

This collection of SQL artefacts can be used to randomly generate date values, either singularly or in batches of up to 10000 values.

Procedures and functions

[SingleValue].[ufn_Get_Date]

This function will return a random colour value. As a function; this method can be used to easily assign a value to an variable, or to update a field on a table.

This function has the following input parameters:

Parameter Data Type Default Value
@MinDate date None
@MaxDate date None

Example usages:

Declare	@Date date

Select @Date = [SingleValue].[ufn_Get_Date] ('2020-01-01','2020-12-31')

[SingleValue].[usp_Get_Date]

This procedure will return a random colour value. The generated value is returned via the output parameter @Date, can be captured in a variable, or passed back to a calling application.

Parameter Data Type Default Value Direction
@MinDate date None Input
@MaxDate date None Input
@Date date None Ouptut

Example usages:

Declare @MinDate date, @MaxDate date, @NewDate date
Select	@MinDate = '1980-01-01',
	@MaxDate = getdate()

exec [SingleValue].usp_Get_Date @MinDate, @MaxDate, @NewDate out

Reviewed to here!!

[Fountain].[usp_Get_Colour]

This procedure will return the next available colour value. This method, whilst not strictly random, ensures that values are evenly over time. The generated value is returned via the output parameter @Colour, can be captured in a variable, or passed back to a calling application.

Example usages:

Declare @Colour varchar(50)
exec	Fountain.usp_Get_Colour @Colour out
Select  @Colour

[BulkValue].[usp_Get_Colour]

This procedure will return up to 10000 random colour values. This procedure has the following input parameter:

Parameter Data Type Default Value
@QuantityRequired smallint None

A recordset with the following structure is returned:

Field Name Data Type
Colour varchar(50)

This method is useful for inserting bulk data directly in to a table, or as an ETL source.

Example Usage:

exec	[BulkValue].[usp_Get_Colour] 100

[BulkFountain].[usp_Get_Colour]

This procedure will return up to 10000 colour values. This method, whilst not strictly random, ensures that values are evenly over time. This procedure has the following input parameter:

Parameter Data Type Default Value
@QuantityRequired smallint None

A recordset with the following structure is returned:

Field Name Data Type
Colour varchar(50)

This method is useful for inserting bulk data directly in to a table, or as an ETL source.

Example Usage:

exec BulkFountain.[usp_Get_Colour] 1000

Clone this wiki locally