Hi at all,
this week I had the task to copy data from User A to User B with priviledges set to users can see and edit their data only. So I had to produce duplicates while preserving relations, i.e. copied records would have to have new IDs and foreign keys would have to be adapted for the copied child records to maintain the relations.
Question is, whether there is a best practice for this task or what I could have done better to get faster results?
This is, what I did:
- Exported the raw data of User A to Excel table for table
- In Excel I set the ID columns to ID value plus 100.000 to get new IDs via a formula. Then I copied the formula results and reinserted them as pure number values. Same happened to the foreign keys to keep the relations.
- In Excel I changed the user column from User A to User B with fill down.
- Then I imported all the tables again.
In my special case a further problem was, that the data of User A should only partially make it to User B. So as a last step I deleted everything in User B´s data that should not appear there. Sadly there was no possibility to query this data, there was only a list like "A, C, I, K, M, P" should appear and the rest not.
Any tips or ideas?