错误0xc0202049: 数据流任务1: 插入只读列失败

我正在使用 SQLServer2008导入和导出向导。我需要导入一个数据库。我打开 SQL 服务器导入/导出向导,执行以下操作:-

  1. 对于目的地,我选择了“ SQL 服务器本机客户端10”。

  2. 然后从一个或多个表或视图中选择复制数据。

  3. SSIS 立即运行

但我犯了以下错误,

手术停止了。

  • 初始化数据流任务(成功)

  • 初始化连接(成功)

  • 设置 SQL 命令(成功)

  • 设置源连接(成功)

  • 设置目标连接(成功)

  • 验证(错误)

消息错误0xc0202049: 数据流任务1: 插入失败 只读列“ ActionID” 魔法师)

错误0xc0202045: 数据流任务1: 列元数据验证失败。 (SQLServer 导入和导出向导)

错误0xc004706b: 数据流任务1: “组件”目标- AuditActions“(22)”验证失败并返回验证状态 “ VS _ ISBROKEN”(SQLServer 导入和导出向导)

似乎不能导入标识列和时间戳列,因此如何强制导入这些值?

112126 次浏览

Before Importing date execute the below query to set identity insert on:

SET IDENTITY_INSERT TableName ON

Then do the import operations.

After importing date execute the below query to set identity insert off:

SET IDENTITY_INSERT TableName OFF

With all due respect to Kishore's answer, that approach is valid if you're modifying the packages. Since you're using the import/export wizard, the more straight forward approach would be to check the Enable Identity Insert box on the Column Mappings tab.

In the Import Export Wizard, after selecting the table for copy, click the Edit Mappings... button

enter image description here

In the resulting screen, click the Enable identity insert property and your identities will be replicated over.

enter image description here

Same net result as issuing SET IDENTITY_INSERT TableName ON & OFF but this is done automagically at build time.