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

2021-12-30 00:00:00 etl sql-server-2008 sql-server ssis

我正在使用 SQL Server 2008 导入和导出向导.我需要导入一个数据库.我打开了 SQL 服务器导入/导出向导,并完成了以下操作:-

I am using SQL Server 2008 import and export wizard. I need to import a database. I opened the SQL server import/export wizard and I went through the following actions:-

  1. 对于目的地,我选择了SQL server native client 10".

  1. for the destination I chose "SQL server native client 10".

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

then I selected copy data from one or more tables or view.

SSIS 立即运行

但我收到以下错误,

操作停止...

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

  • Initializing Data Flow Task (Success)

初始化连接(成功)

设置 SQL 命令(成功)

Setting SQL Command (Success)

设置源连接(成功)

设置目标连接(成功)

正在验证(错误)

消息错误 0xc0202049:数据流任务 1:插入失败只读列ActionID".(SQL Server 导入和导出巫师)

Messages Error 0xc0202049: Data Flow Task 1: Failure inserting into the read-only column "ActionID". (SQL Server Import and Export Wizard)

错误 0xc0202045:数据流任务 1:列元数据验证失败.(SQL Server 导入导出向导)

Error 0xc0202045: Data Flow Task 1: Column metadata validation failed. (SQL Server Import and Export Wizard)

错误 0xc004706b:数据流任务 1:组件"目的地 -AuditActions" (22)" 验证失败并返回验证状态VS_ISBROKEN".(SQL Server 导入导出向导)

Error 0xc004706b: Data Flow Task 1: "component "Destination - AuditActions" (22)" failed validation and returned validation status "VS_ISBROKEN". (SQL Server Import and Export Wizard)

似乎我无法导入标识列和时间戳列,那么如何强制导入这些值?

It seems that I can not import identity columns and timestamps columns, so how I can force these values to be imported?

推荐答案

在导入日期之前执行以下查询以设置身份插入:

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

SET IDENTITY_INSERT TableName ON

然后进行导入操作.

导入日期后执行以下查询以关闭身份插入:

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

SET IDENTITY_INSERT TableName OFF

相关文章