1
I’m trying to send some records from one bank (bank A) to another (bank B) that contains the same structure. They are records of 3 tables, 1 table(patient) contains MAIN records and the other 2(file and scheduling) are COMPLEMENTARY data(foreign key with the MAIN).
Setting:
My difficulty is with the Ids. Because the bank A and bank B already have records and the Ids of one already exists in the other. I want to ignore the IDS of the Origin table, but I cannot lose the relationship with the other 2 tables.
I tried to make a:
insert bancoB.paciente
USANDO dados de:
select ... bancoA.paciente
But as I have relationships to take too, when making the children tables Inserts the ID table FATHER(patient) will get lost.
**
Follows the properties of the 3 tables:
**
Main table:
Table Filho1:
Table Filho2:
if it is not replication can change the IDS, then what I see might help was, make a cursor that takes the data of "patient", make the Insert in the other bank, take the new ID and make the Insert of the other tables using the new ID, has to be done one by one, so a cursor can help there
– Ricardo Pontual
Cool, I thought about this strategy, but I couldn’t reproduce, it should be a precedent? has some example of code?
– Willians Martins