Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to import data from one database to another. On the destination database, I don't have permission to restore a backup file to it, so I have only one option which is to import data.

I used the wizard and I set the option of allow identity insert, but after it ran I faced a problem with foreign keys insertion. Is there anything I missed or shall I drop the foreign keys and recreate it after import?

I really wonder why Microsoft made it complicated.

share|improve this question
Have you tried just disabling the FK constraints, import, then enable them again. e.g.… – Shawn Melton Aug 25 '12 at 14:12

You could drop the foreign keys, but if the tables are large and/or you have busy environment, be sure to test your insert times before you do anything on production. In regard to new keys, it shouldn't throw a problem, but if you're trying to insert duplicate keys then you'll get errors. Also, be sure to insert parent entities first (if you don't drop foreign constraints first!) then child entities.

share|improve this answer
**Insert the parent entity first then their child otherwise it will conflict the  **FOREIGN** KEY Constraint.**
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.