c# + sql server: I have to import a few tables from Access into sql server. The new sql server tables are already defined and created. The Access tables have primary key - foreign key relationships that have to be maintained. I would like to have the new sql tables use identity values for the primary keys, but I can't easily load the legacy rows and maintain the relationships if I do that. I could possibly load the data using identity_insert but I have to back way out of my ORM software (subsonic) to do that. Perhaps I can make my new primary keys non-identity types, but then there is the hassle of generating unique ids for all the rows I add later. I'm sure this has a decent solution out there somewhere.
+1
A:
Create the tables with the PKs as "int" (without identity), load your data, and then change the PK fields to int identity...
KristoferA - Huagati.com
2008-10-07 04:21:59
+1
A:
Could you import the primary keys as non-identity types, then once all the data from all the tables is imported change them to identity types?
Chad Braun-Duin
2008-10-07 04:24:30