Primary key violation populating an empty table
pebishop
Posts: 1
I have a three-column table (table1) with columns ID (int), key (varchar) and value (varchar). The primary key on the table is formed from columns ID and key.
The data generator is setup to populate this table using the rules:
ID = Reference Foreign Key FK_table1_table2 for column [dbo].[table2](ID), seed = 0, All key values unique
key = [sourcedb].[dbo].[table1].[key]
value = [sourcedb].[dbo].[table1].[value]
table2 has about 150 unique rows, table1 (in the source database) has about 3000. The target table is empty before the generator is run.
The problem is that this is violating the primary key when populating the target table. Is there a way to handle this type of population where both halves of a primary key are coming from different sources but must remain unique?
The data generator is setup to populate this table using the rules:
ID = Reference Foreign Key FK_table1_table2 for column [dbo].[table2](ID), seed = 0, All key values unique
key = [sourcedb].[dbo].[table1].[key]
value = [sourcedb].[dbo].[table1].[value]
table2 has about 150 unique rows, table1 (in the source database) has about 3000. The target table is empty before the generator is run.
The problem is that this is violating the primary key when populating the target table. Is there a way to handle this type of population where both halves of a primary key are coming from different sources but must remain unique?
Tagged:
Comments
Unfortunately SQL Data Generator does not handle composite Primary Keys - the issue has internal reference SDG-921 and I have added a reference to your issue there.
Kind regards,
Alex
Have you visited our Help Center?
Tables with multi column PK are very common and not manage those tables is a big restriction.
SDG does not handle composite Primary Keys, where two or more columns make up the Primary Key.
When this issue was originally found a few years ago, at the time it was decided by the Dev team that a fix would not be released.