使用导出导出向导违反主键

时间:2015-08-12 20:38:19

标签: sql sql-server ssis

将表从一个实例复制到另一个实例时,我收到以下消息:

Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.

An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80004005  Description: "The statement has been terminated.".

An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80004005  Description: "Violation of PRIMARY KEY constraint 'PK_RGENRL'. Cannot insert duplicate key in object 'dbo.RGENRL'.".
 (SQL Server Import and Export Wizard).

在导入大型记录之前DROP或禁用PK并重新启用它是一个好习惯吗?任何建议将不胜感激。 感谢

1 个答案:

答案 0 :(得分:0)

取决于你的牌桌。如果没有允许重复,则您将无法重新启用该表上的主键约束,因为PK将包含重复项