I need a tool or method that allows the transfer of data and automatically updates the foreign keys at the destination table.
The SET IDENTITY_INSERT ON/OFF is not what I'm looking for.
Example:
table master (id int identity, name char)
table slave (id int identity, master_id int, name char)
I would like to create a script like this:
insert into master(name) values ('master a')
insert into master(name) values ('master b')
insert into slave(master_id,name) values ( ?, 'slave aa')
insert into slave(master_id,name) values ( ?, 'slave bb')
insert into slave(master_id,name) values ( ?, 'slave cc')
insert into slave(master_id,name) values ( ?, 'slave dd')
When inserting the slaves, I would like to know what is the new value of the master_id, in order to keep the same relation as in the original table.