SQL Data Generator
Latest version: 2.0
Knowledge Base
Self-referencing table constraints can cause generation to stop
Category: Troubleshooting & error messages
Date: 17 Sep 2009
Product: SQL Data Generator
When generating data against a table which has foreign key references to itself, the following error may occur:
"Generation stopped. The generator for column [COLUMN] could not generate any more values"
The following example illustrates a reproduction for this issue:
CREATE TABLE [dbo].[Account]
(
[AccountID] [uniqueidentifier] NOT NULL,
[AccountNumber] [nvarchar] (12) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[AccountName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[AccountType] [int] NOT NULL,
[LedgerID] [uniqueidentifier] NULL,
[UniqueID] [int] NOT NULL IDENTITY(1, 1),
[Version] [datetime] NOT NULL,
[FinYearID] [uniqueidentifier] NOT NULL
)
GO
ALTER TABLE [dbo].[Account] ADD CONSTRAINT [AccountTypeRule] CHECK (([AccountType]=(1) OR [AccountType]=(2) OR [AccountType]=(3) OR [AccountType]=(4) OR [AccountType]=(5)))
GO
ALTER TABLE [dbo].[Account] ADD CONSTRAINT [PK_Account] PRIMARY KEY CLUSTERED ([UniqueID])
GO
ALTER TABLE [dbo].[Account] ADD CONSTRAINT [UK_AccountID_FinYearID] UNIQUE NONCLUSTERED ([AccountID], [FinYearID])
GO
ALTER TABLE [dbo].[Account] ADD CONSTRAINT [UK_AccountName_FinYearID] UNIQUE NONCLUSTERED ([AccountName], [FinYearID])
GO
ALTER TABLE [dbo].[Account] ADD CONSTRAINT [FK_Account_FinancialYear] FOREIGN KEY ([FinYearID]) REFERENCES [dbo].[FinancialYear] ([FinYearID])
GO
ALTER TABLE [dbo].[Account] ADD CONSTRAINT [FK_LedgerID_AccountID] FOREIGN KEY ([LedgerID], [FinYearID]) REFERENCES [dbo].[Account] ([AccountID], [FinYearID])
GO
This is a known issue and we are currently evaluating support for this scenario.
Document ID: KB200909000424 Keywords: SQL, Data, Generator,foreign,key
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