Export/Import Related data in multiple tables

I am looking for ways to Export/Import Related data in multiple tables from one environment to another. The table structures remain the same. I found ways to export data from multiple tables with individual SQL in TOAD in one script, but I am looking for exporting related data only. Say for instance get CUSTID, CUSTNAME FROM customers table and then get all the employees tied to that CUSTID in EMP table by extracting EMPID,EMPNAME,CUSTID.

I would like to then use the Import or Load utility to load that data in a different set of tables.

Hi Anil,

You can use the Query type export object and have the query get related data from both tables.

Such as:
SELECT PAR.ID, PAR.PARENT_COLUMN_A, CHI.CHILD_COLUMN_A
FROM TB_PARENT PAR, TB_CHILD CHI
WHERE PAR.ID = 1 AND PAR.ID = CHI.ID

Then import the data into the new tables from the single file.

Regards,
Adam

There’s also an import query feature in import wizard, you can use the query above to import the result set to a different server/schema.

There’s also an import query feature in import wizard, you can use the query above to import the result set to a different server/schema directly.

Message was edited by: Kiki

I did not find the Import query option in the Import Wizard. On the Target screen, I see only Single table or a Create a new Table option.

I am not fully sure I understand what you are trying to accomplish, however, I know you can use the import wizard and specify two queries, each with a new table as the target. Please see the attached document for details on how that is done with Toad DB2 5.0.
Forum122011.docx (339 KB)