What are the challenges you face when working across database platforms? Take the survey

How to use the SQL Statement generator?

gvsoftgvsoft Posts: 20 Bronze 1

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?




  • Options
    gvsoftgvsoft Posts: 20 Bronze 1
    Nevermind. Problem solved...I had the "Shuffle data" checkbox checked. Unchecking that gave me the result I was looking for.

    - Dennis
  • Options
    gvsoftgvsoft Posts: 20 Bronze 1
    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
  • Options
    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.
Sign In or Register to comment.