I have two questions relating to migrating SQL data:
1. Migrate increment ID from db1.table
to db2.table
(different database)
Example:
My nightmare is when I have to move data for these 3 tables from one database to another database. The id in two database is not identical.
For now, my best practice is after migrating Guest
and Room
tables, I will use Excel with Vlookup
to update all GuestId
and RoomId
in table Booking
with new ID and after that migrating all these modified data.
Question: are there any better ways to go through this nightmare?
Please note that in this example, only 3 tables mentioned but in my real situation, it is not less than 5 tables joining together...
2. Migrate from IncrementId to Guid
For new project design, I'm using unique Guid instead of traditional increment ID for the table's primary key.
Question: What is the best practice to migrate old SQL Server table from incremented Id to Guid?
EDIT: I'm using SQL Server 2012 and can even use Entity Framework to access my database. So as long as it can help, SQL script or C# programming code are both useful