SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
[SA 6] - Generated data violates primary key

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
[SA 6] - Generated data violates primary key
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 1394

Post [SA 6] - Generated data violates primary key Reply with quote
I have a table with a compound primary key consisting of 3 columns. These are set to type 'lookup table' (they should be references to two other tables, but foreign keys are not defined). Data generator generated at least two records (out of 1000) that have all three columns matching in value.
Fri Aug 19, 2011 5:05 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6499

Post Reply with quote
The data-generator doesn't generate sets of values for composite columns keys, it generates each column values independently. Can you set generation method for one of the column value to sequence to ensure that value is unique in every row and so is the composite key?
Thu Sep 01, 2011 11:49 pm View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 1394

Post Reply with quote
SysOp wrote:
The data-generator doesn't generate sets of values for composite columns keys, it generates each column values independently. Can you set generation method for one of the column value to sequence to ensure that value is unique in every row and so is the composite key?


Good idea, I'll try that. By the way, is there way to specify a default minimum for datetime type columns when using sequence as Value Type? Not setting one results in SA generating the first value with missing date part (time part is present and it's '00:00:00') which causes the query to fail.
Fri Sep 02, 2011 2:56 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6499

Post Reply with quote
It should be possible to specify min-max value range for all date and time based columns. Is that what you mean?
Fri Sep 02, 2011 5:01 pm View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 1394

Post Reply with quote
Not exactly. It is possible to specify those values manually but not specifying the minimum will generate a value for the first record that is considered invalid when inserting, though I don't understand why. The value is '00:00:00' (at least this one is shown in the preview) which should be perfectly fine. I'll save the script to see what does it do when it is executed from the studio, will update tomorrow.

UPDATE: there must have been some other issue(s), possibly related to some foreign keys. I created a test table and the test data generation ran without any problems.
Sat Sep 03, 2011 12:43 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.