SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Procedure for Random Numbers

By nagdimunovd,

Here is handy procedure to generate random number.
I find it useful when I generate large amount of test data in a database.
For example if you need to create a Customer Data and what they have purchased in the last month to run perfrmance tests on large amount of data an set up necessary indexes.
You can insert records into customer table and put in a random amount for the purchase price or assign a ID of related item id, if Index in the related table is sequential you can put in min(id) and Max(id) get a random item id and Assign it to your customer record.
Also you can use it when ever you need to generate a random number between 2 numbers.

Good Luck

Total article views: 582 | Views in the last 30 days: 1
Related Articles

Random number generator

Random numbers


Generating Non-uniform Random Numbers with SQL

Some FUNCTIONs to help generate non-uniform random numbers from uniform random numbers including Nor...


Random Data Generator

A query to generate random values for several different data types.


How to Get Random Numbers

How to Get Random Numbers


Random Phone numbers

Can anyone help me generate a statement that will update a table with random phone numbers with the ...