Regarding SQL STATEMENT generator

The simplest way to populate your database with test data.

Moderators: David Atkinson, Anu Deshpande, Lionel

Regarding SQL STATEMENT generator

Postby kiran.karamsetti » Fri Jan 02, 2009 8:36 am

Hi ,

I have tables like:

1. Rep(RepID, rep_name,Active) -> has id= 1 to 100 records
2. Role(RoleID, RoleCode, Active) -> has id = 1 to 30 records
3. RepRole(ID, RepID, RoleID)

and I need to populate the below table:

Table_1(id,name, created_repID,Created_RoleID).

So i am generating the data for created_repID randomly between 1 to 100. And I need to populate the Tables_1.Created_roleID from the REPROLE table for that respective Created_repID. How can I do this in RedGate generator tool?

Here i tried to write a query:
how to complete the below query. I need to pass the table_1.Created_repID as the parameter to the below query.
"Select RoleID from RepRole where repid =" + ?;

please give me a suggestion.
Last edited by kiran.karamsetti on Mon Jan 05, 2009 1:42 pm, edited 1 time in total.
kiran.karamsetti
 
Posts: 4
Joined: Fri Jan 02, 2009 8:20 am

Postby Brian Donahue » Fri Jan 02, 2009 4:02 pm

Hi,

It's not documented but I have been told that Data Generator cannot use newly-generated values to populate another column, so it wouldn't be possible to access data that has not yet been inserted into the database.

You could use a foreign key generator or foreign key (manual) generator to populate values from one column into another column.
Brian Donahue
 
Posts: 6668
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