I seem to have found a "feature" in the SQL2005 Import Export Wizard that generates errors only when the "Optimize for many tables" box is checked. Apparently, there is no way to copy tables with clustered indexes when this option is checked:
The servers are 2 SQL 2005 Standard with all the latest SPs etc on 2 virgin systems.
The source server is Win2003 Server Std, the destination WinXPpro SP2.
I start the wizard and get to the point where I select the tables.
I highlight a few of them, click the "Edit Mappings" button and check "delete rows in existing tables" and check "enable identity insert" with the destination schema name of dbo.
Then close that window. I click on the optimize for many tables and run in a transaction.
I go ahead and execute the package and get the following errors:
TITLE: Microsoft.SqlServer.DtsTra
nsferProvi
der
--------------------------
----
ERROR : errorCode=-1071636471 description=SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "The statement has been terminated.".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Cannot insert duplicate key row in object 'dbo.Address' with unique index 'UIX_Address_AddressGUID'.
".
helpFile=dtsmsg.rll helpContext=0 idofInterfaceWithError={8B
DFE893-E9D
8-4D23-973
9-DA807BCD
C2AC}
After trying also to drop and recreate the tables, I get the same problem again. The solution being to get rid of the extra keys (this is NOT a viable option, since the tables must be exactly as they are on the server and this has to be duplicated nightly).
If I UN-check the optimize tables option and re-choose each table manually with everything else being identical
( I check "delete rows in existing tables" and check "enable identity insert" for each table individually) then
I don't get ANY errors and the job completes. HOWEVER, if I do the same with every table, I get a warning saying I should OPTIMIZE, (which I don't click as it always fails with that option) the job fails.
Go Figure!
Any ideas