Question Howto import data in related tables with existing records (1 Viewer)

roi8877

New member
Local time
Today, 05:16
Joined
Jun 1, 2009
Messages
7
I had followed the post
http://www.access-programmers.co.uk/forums/showthread.php?p=849961 but im quiete concerned with the pk.

I have a few related tables which they all branch off from a main table. Lets call it the top level table. Also the top level table already has records and it's pk is long interger random. (Someone has already made this database, im tasked to see if can import lots of records from excel into these related tables)

So my intention was to have all the data in excel with all the fields in the related tables. (So for example if i had 4 related tables, the excell will have all its fields)

I will import into a temp table all the fields from excel.

Now the question is with method provided here,
http://www.access-programmers.co.uk/forums/showthread.php?p=849961

How do we get deal with getting the data into table which already has existing records? If they had existing records, they would already have PK which can potentially conflict if we already generated PK on the temp table.

Thanks
 

Guus2005

AWF VIP
Local time
Today, 14:16
Joined
Jun 26, 2007
Messages
2,645
Since the PK is random this shouldn't be a problem.

In my consolidated databases i use a GUID as PK. Which is longer and more random. The chances of getting a duplicate are extremely small.

Create a table with old pk and new pk. To keep the relation between the two. Change every occurence of the old pk into the new one. When finished, import the excel data and do the same with these records.

HTH:D
 

Users who are viewing this thread

Top Bottom