Ask a questionAsk a question
 

Answerdata generation with violation UNIQUE KEY constraint/PRIMARY KEY constraint

  • Sunday, November 01, 2009 11:38 PMbobo224 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hello,

    I'm trying to generate data for 3 tables.
    TABLE 1 has 2 rows to insert
    TABLE 2 has 96 rows to insert
    TABLE 3 has 179 rows to insert
    I selected data bound generator from production db for most of the columns of the tables - I have to use the same values as the production.

    When I generate data for the tables, I get violation of UNIQUE KEY constraint/PRIMARY KEY constraint errors.
    When I look at data generation preview, I see duplicates for some columns which shouldn't have.

    According to the generator output query (SELECT * FROM prodution table), there are no duplicates and I'm trying to insert the exact number of rows which I get from the production db.

    Can you please tell me what's wrong here?

    Thanks
    Bo

Answers

  • Monday, November 09, 2009 11:05 PMGenevieve OrchardMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Bo,

    Have you tried using the sequential data bound generator instead of the data bound generator? I think it will solve your problem of duplicate values because it reads the data sequentially from the source database instead of pulling it at random.
    -Genevieve Orchard (VSTS Database Edition Test Team)

All Replies

  • Tuesday, November 03, 2009 1:00 AMGenevieve OrchardMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Bo,

    Are you clearing existing data from the target database before generating new data? If yes, are you getting the constraint violation errors on columns where you're using the data bound generator or other generators? Do you have any compound keys or self-referencing foreign keys?
    -Genevieve Orchard (VSTS Database Edition Test Team)
  • Wednesday, November 04, 2009 5:29 AMbobo224 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Genevieve,

    thanks for your reply.
    I clicked 'YES'  for "Do you want to clear the contents of the selected tables before inserting new rows?".

    I get the constraint violation errors on the columns using data bound generator which comes from the production data and of course, there are no violation errors with the production data.

    There are no foreign keys on the tables.

    thanks
    Bo
  • Monday, November 09, 2009 11:05 PMGenevieve OrchardMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Bo,

    Have you tried using the sequential data bound generator instead of the data bound generator? I think it will solve your problem of duplicate values because it reads the data sequentially from the source database instead of pulling it at random.
    -Genevieve Orchard (VSTS Database Edition Test Team)