Neil Knight
Neil Knight

Reputation: 48567

Exporting from an old DB structure to new DB structure

I have inherited a database that has no real referential integrity at all, so I've created a new database with this corrected. The problem I have now, is that I have large amounts of data (around 50million rows) with previously assigned IDs. I need to keep these IDs in my new Database else I'll lose a lot of references from the data. So, initially I thought of turning off the Identity on the columns, and then insert the data and switch it on.

Does this sound like a feasible plan? Are there any flaws to this? Has anyone tried and tested it?

Upvotes: 0

Views: 61

Answers (1)

wRAR
wRAR

Reputation: 25560

SET IDENTITY_INSERT ON is just for these cases. Don't forget to adjust identity counters after insert.

Upvotes: 2

Related Questions