Putting values in a SQL Matrix.- it has a compound key

The simplest way to populate your database with test data.

Moderators: David Atkinson, Anu Deshpande, Lionel

Putting values in a SQL Matrix.- it has a compound key

Postby AndrewRMClarke » Thu Nov 06, 2008 1:05 pm

I create a table....

create table matrix (x int not null,y int not null,element numeric(18,2) not null PRIMARY KEY (x,y))

I want to populate it with values for a matrix of 15(x) by 15(y). This would mean I'd want all unique combinations OF x AND y up to 15 in each case. I don't seem to be able to do it with SQL Data Generator.

Compound keys consist of several columns, in which all values are known (not null) and, in combination, are unique.
AndrewRMClarke
 
Posts: 48
Joined: Wed Aug 16, 2006 3:17 pm
Location: Cavendish

Postby Brian Donahue » Tue Dec 30, 2008 1:49 pm

Hi Andrew,

I'd like to know what problem you run into. When I use your table, I set the table settings so that 15 rows are generated and when data is invalid, to skip the row. The downside is I always end up with very predictable data:
x y
1 1
2 2
3 3
... ...
Changing the column settings for x and y to use a range between 1 and 15 and randomizing generates more realism:
x y
1 9
2 3
4 11
... ...
Brian Donahue
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am


Return to SQL Data Generator 1

Who is online

Users browsing this forum: No registered users and 0 guests