Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
matt_calhoon
Posting Yak Master
235 Posts |
Posted - 2007-08-21 : 21:59:15
|
Hi there,Having problems exporting data from a database (sql2000 db) to a development db (also sql2000) using SQL 2005 Server Studio and Import/Export wizard (error: Violation of PRIMARY KEY constraint <keynamehere>. Cannot insert duplicate). The destination table has no records in it. I followed the instructions here:----------------------------------------------------Run the following on the 2000 databaseexec sp_msforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'exec sp_msforeachtable 'ALTER TABLE ? DISABLE TRIGGER ALL'Then use the export wizard on 2005, select all tables and viewsEdit Mappings and check the Enable Identity Insert boxUN check the Optimise for many tables boxDeselect ALL the views so that it is only tables that are copiedRun the export ignoring the warningAfter the export is completeRun the following on the 2000 databaseexec sp_msforeachtable 'ALTER TABLE ? CHECK CONSTRAINT ALL'exec sp_msforeachtable 'ALTER TABLE ? ENABLE TRIGGER ALL'----------------------------------------------------but it gives me:Violation of PRIMARY KEY constraint <keynamehere>. Cannot insert duplicate.Ive burnt a few hours on this now and thinking there must be something I am missing! |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-08-21 : 22:37:25
|
Tried in em? |
 |
|
|
|
|