Column Data Referenced / Selected by Another Columns Data

The simplest way to populate your database with test data.

Moderators: David Atkinson, Anu Deshpande, Lionel

Column Data Referenced / Selected by Another Columns Data

Postby aseniuk » Mon Dec 07, 2009 7:17 pm

Hi All,

I was wondering how I would do something like this. Lets say we want to get the gender of the person or rather select the gender first then fill in an appropriate name based on the gender.

Other areas where this would also be handy would be postal code, filling in the postal code based on the country/stat and, Phone numbers.

If anyone has an idea on how to achieve this please give me a post.

Thanks
Database Analyst
Alberta Justice and Solicitor General
aseniuk
 
Posts: 16
Joined: Tue Jun 16, 2009 8:51 pm

Postby Linda Hawksworth » Wed Dec 09, 2009 11:46 am

SQL Data Generator will not do what you want out of the box but please see the following article:

http://www.simple-talk.com/content/arti ... rticle=697

which explains how to use the IronRuby generator to manipulate data. Specifically, please see the example of using conditional logis in that article:

title = table.row(\"Title\")
if(title == \"Mr\")
column.set \"M\"
elsif(title == \"Miss\" or title == “Ms”)
column.set \"F\"
else
column.set \"?\"
end

You can use the NamesFirstMale.xml and NamesFirstFemale.xml files in the above code to specify male or female names in a specific column base on gender.

Let me know if this is what you need.
Linda Hawksworth
 
Posts: 192
Joined: Mon Jun 25, 2007 11:32 am


Return to SQL Data Generator 1

Who is online

Users browsing this forum: No registered users and 1 guest