Subject Re: [IBO] Importing data from duplicate database
Author Woody
From: "Ed Dressel" <Dressel@...>
> Thanks for the response.
>> I don't think you need to know the PK and FKs as long as you copy
>> the data of the primary tables first.
> I am not sure I understand this. The PKs will change in the new
> database, then the import tool needs to know that.

If you are saying that the PKs are going to be generated in more than one
database and you have to synch them, then the only way to guarantee
uniqueness is to prefix all PKs with a unique ID from each database. You
can't copy a record over and change it's PK/FK value and expect to ensure
uniqueness across DBs. There would also be no way for one database to know
that the other database has the same record but that it has a different PK
value. You have to maintain the same values across all copies. Therefore,
the only way to do that is for each database to generate it's own PK value
only for new records it creates, not for imported ones.

>> Something like this:
>> for x := 0 to IBData1.FieldCount-1 do
>> if Assigned(IBData2.FindField(IBData1.Fields[x].FieldName)) then
>> IBData2.FieldByName(IBData1.Fields[x].FieldName).Assign(
>> IBData1.Fields[x]);
> That is what I was thinking--just adding PK and foreign key awareness
> (and some special cases, which I am aware of in my database).

Again, read what I wrote above. Does that sound like your situation?

Woody (TMW)