How to use the SQL Statement generator?

The simplest way to populate your database with test data.

Moderators: JonathanWatts, David Atkinson, Anu Deshpande, Michelle Taylor, Lionel, Emma A, sherr

How to use the SQL Statement generator?

Postby gvsoft » Fri Sep 07, 2012 11:50 pm

Hi,

How can I use the value of a column (the value of which is generated by the decimal/numeric generator) to generate the value of another column? For example, I have a table with Height and Weight columns. I am generating values for the Height column using the decimal/numeric generator. Then I want to use the Height value to produce a corresponding Weight value. I thought I should be able to use the SQL Statement generator to do this, but either it doesn't work, or I am not using it correctly. For instance, I would like to do something like this:

SELECT 25 * Height * Height FROM <tablename>

and store the result in the Weight column, and have it work for each row that gets generated.

Unfortunately, the values I get back don't make sense.

Any suggestions?

Thanks,

Dennis
gvsoft
 
Posts: 16
Joined: Thu Jul 19, 2012 12:11 am

Postby gvsoft » Fri Sep 07, 2012 11:56 pm

Nevermind. Problem solved...I had the "Shuffle data" checkbox checked. Unchecking that gave me the result I was looking for.

- Dennis
gvsoft
 
Posts: 16
Joined: Thu Jul 19, 2012 12:11 am

Postby gvsoft » Sat Sep 08, 2012 12:08 am

I take it back...it doesn't work. It works, but it uses the data currently in the database as the source, not the generated data values. I want it to use the generated values from the other column. Is this even possible?

- Dennis
gvsoft
 
Posts: 16
Joined: Thu Jul 19, 2012 12:11 am

Postby Brian Donahue » Mon Sep 10, 2012 9:40 am

Hi Dennis,


SQL Data Generator currently does not support generating data for a column based on data generated for another column in the same table. The workaround is to use the Iron Ruby Generator, but this is pretty difficult to do.

Please see topic:
http://www.red-gate.com/MessageBoard/vi ... light=ruby

I may need to do a new build of Ruby generator if you are using a different version of SQL Data Generator.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am


Return to SQL Data Generator 2

Who is online

Users browsing this forum: No registered users and 0 guests