PK/FK constraints

M

Mike R.

Does anyone know how to extract data from an old source table and insert the
records into new tables (within the same database).

The problem I'm having is that the new tables are now truly "relational"
(one-to-many relationships). Essentially, I have the new tables plus one
"junction table" that stores all the foreign keys for the relationships.

I simply don't know as to how I could populate the junction table with the
"foreign key numbers" -- which are the autonumbers (primary keys) of the
other data storage tables.

I guess the process should be something like this:
- read field1 from source table
- append field1 into new table1
- temporarily store the autonumber of table1 (in memory)
- add the in memory stored autonumber and add it to "junction table" into
the foreign key field (between table1 & table2)
- read field2 from source table
- append field2 into new table2
- and so on....

.... not sure if the procedure described above would work... but I think it
may get the point across.


Thanks in advance,
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top