SQL Data Generator - 2.0
Customizing existing generators - SQL Data Generator
You can customize the generators in the following ways:
- change the settings for each column
- for generators that use lists, create a custom list of values
Changing the settings
When you select a generator for a column, you can customize the generator by changing the default settings.
For example, in the Personal category, Working Age is pre-configured to have a minimum value of 18 and a maximum value of 65. However, in your company the minimum age may be 21, so you can change this value in Min.

Similarly, if you have selected the Title generator, you may want to add the title Prof. To do this, you can edit the expression in Regular expression. Change:
Mr|((Mrs|Miss|Ms)|Dr)(\.?)
To:
Mr|((Mrs|Miss|Ms)|Dr|Prof)(\.?)
For more information about regular expression generators, see RegexpGenerator.
This is a good way to customize a generator for an individual column.
Creating custom lists
Some of the generators use lists of values (dictionaries) to supply the data. For example, First Name (Female) uses the list NamesFirstFemale.txt
The lists are located in:
You can create your own lists by creating a text file with each value on a new line. You can then amend the generator settings so that it uses your file. For example, for First Name (Female), click Browse... to select your file. Alternatively, you can use the generic File List generator.
For generators that use regular expressions such as Full Names, edit the regular expression to specify the name of the new text file.

For more information about regular expression generators, see RegexpGenerator.
If you will want to use the generator with the custom list again, you can create a new generator that references the custom list file, see Creating a custom generator below.
Creating a custom generator
You may find that you want to make the same customizations for a number of columns. In this case, you can customize a generator and add it to the list of available generators so that you can re-use it.
To do this, find the SQL type or generic generator that you want to base the custom generator on, and then find its corresponding .xml file in:
Create a copy of the .xml file and name it appropriately, then edit the contents to specify the properties as required.
The example below shows the code for the Working Age generator which generates random integers between 18 and 65. It is based on Int32Generator.xml:
<?xml version="1.0" encoding="iso-8859-1"?>
<generators>
<generator
/* Specify the class. */
type="RedGate.SQLDataGenerator.Generators.Number.
Int32Generator"
/* The name and description to be displayed
in the generators list, */
/* and its category */
name="Working Age"
description="29,30,35,18..."
category="Personal">
/* Set the properties for the generator. */
<property name="MinValue">18</property>
<property name="MaxValue">65</property>
/* Specify the columns that match, and their score. */
<matches field="Age" score="50"/>
/* Define the data types for which the generator
is valid. */
<type type="Int64"/>
<type type="Int32"/>
<type type="Int16"/>
<type type="Byte"/>
</generator>
SQL Data Generator uses the matches field string when it allocates the generators to columns. You can specify a regular expression search string. You then specify a score; if more than one generator matches a particular column, SQL Data Generator uses the one with the highest score.
See also |
Was this article helpful?
SQL Data Generator
- Creating random GUIDs in SQL Data Generator
- Conforming to unique constraints in SQL Data Generator
- Generating data in improperly-named column causes System.InvalidOperationException
- Self-referencing table constraints can cause generation to stop
- Logging and log files
all SQL products
- Compatibility of Red Gate tools in 64-bit environments
- Application has encountered an error and needs to close
- Error message after installing SQL Toolbelt - The description for Event ID ( 1 ) in Source ( nview_info ) cannot be found.
- Changing the temporary directory used by the installer
- Toolbelt Installer "hanging" while "scanning volumes"
- Login failing with "trusted SQL Server connection" error when using RunAs
all products
- Some Red Gate products identified as containing a trojan by Anti-Virus software
- Activation may fail with Unknown Error -1
- Product uses web help although a CHM file is available locally
- Argument exception resulting from missing environment variable
- Check for updates may fail when used through proxies
- 'Unidentified Publisher' error when repairing or uninstalling
- Licensing activates product as standard edition
- Moving Red Gate software products to another machine
- Red Gate tools log locations
- The application UI opening slowly when there is no internet access
SQL Data Generator
- Activating your products
- Activating your products
- Getting help offline
- Cleansing or removing sensitive data from an existing data source
- SQL Data Generator release notes - version 1.xx
- SQL Data Generator release notes - version 2.xx
all SQL products
all products
- Red Gate product acknowledgements
- Activating your products
- Activating your products
- Red Gate bundle history
- Check for updates
- Troubleshooting Check for Updates errors
- Current versions
- Deactivating your products
- Installing Red Gate products from the .msi file
- Requesting additional activations
- Serial numbers for bundles
- Reactivating using a different serial number
- Extending your trial
- Finding your serial numbers
- Moving a serial number from one computer to another
- No response received for manual activation
- Licensing and activation resources
- Licensing and activation resources
- Troubleshooting licensing and activation errors
- Licensing and activation FAQs
- Red Gate tools log file locations
- Download old versions of products
- Download product prerequisites & utilities
- Support & upgrades
- Upgrading your software
- Upgrading FAQs

Using SQL Data Generator