views:

23

answers:

2

Scenario:

I have some
MAIN_TABLE1
MAIN_TABLE2
these main tables are in relational schema.

Now, I need to move the data from this relational schema to some other flat tables:

flat_Parent_Table
flat_Child_Table1
flat_Child_Table2
flat_GrandChild1
flat_GrandChild2

Now one record from MAIN_TABLE1 goes to multiple flat tables. Now what should be the logic here to move the data in these flat tables and create a relational schema on these flat table.

+1  A: 

This is an Extract, Transform, Load (ETL) problem. If you're using SQL Server 2005 or above, you can use SSIS. If not, you can use DTS. The precise logic for how you de-normalize your data depends on what you are trying to accomplish. There are many good books on that subject. Also, check out the Kimball Group.

JP Alioto
A: 

The logic is up to you, but the process would be to build a script (perhaps Perl) to connect to the DB, read the records out of the main tables, and apply the insert stmts to push the data into the child tables.

mlathe