3

我知道这个问题可能会重复。但我对此有不同的看法。我已经创建了没有数据的表“CRM_Doctor_Budget”。

在 sql server 2008 中创建的表

我想从excel文件在这个表中插入数据。

我正在使用导入和导出数据(32 位)。

按照我做的步骤:

第一步

第二步

第三步

第五步

第六步

第七步

第八步

我得到的错误:

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

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

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

Error 0xc004700c: Data Flow Task 1: One or more component failed validation.
 (SQL Server Import and Export Wizard)

Error 0xc0024107: Data Flow Task 1: There were errors during task validation.
 (SQL Server Import and Export Wizard)

我在转换 varchar、int、smallint、bit 数据类型时遇到错误。因为 excel 文件具有所有数据的通用数据类型。在我已经创建的表中,我有 varchar、int、float、smallint 和 bit。

检查“启用身份插入”后,我得到的错误较少,但错误如下:

Copying to [dbo].[CRM_Doctor_Budget] (Error)
Messages
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: "Unspecified error".
 (SQL Server Import and Export Wizard)

Error 0xc020901c: Data Flow Task 1: There was an error with input column "Id" (143) on input "Destination Input" (72). The column status returned was: "The value violated the integrity constraints for the column.".
 (SQL Server Import and Export Wizard)

Error 0xc0209029: Data Flow Task 1: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "input "Destination Input" (72)" failed because error code 0xC020907D occurred, and the error row disposition on "input "Destination Input" (72)" specifies failure on error. An error occurred on the specified object of the specified component.  There may be error messages posted before this with more information about the failure.
 (SQL Server Import and Export Wizard)

Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "Destination - CRM_Doctor_Budget" (59) failed with error code 0xC0209029 while processing input "Destination Input" (72). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.  There may be error messages posted before this with more information about the failure.
 (SQL Server Import and Export Wizard)
4

2 回答 2

2

我已经解决了这个问题。我做了一些改变,比如:

在编辑映射中:因为我有 ID 作为标识列,它是自动生成的列。

和以前一样,我已经映射了 Id 列。

现在这一次我没有映射 ID 列并取消选中“启用我身份插入”

否则我按原样执行步骤.. 我已经完成了这个小改动,并且我成功导入了记录。:) 谢谢大家的帮助。

于 2013-03-07T07:13:39.180 回答
1

ID 列是标识列吗?因为如果是,您需要单击“启用身份插入”复选框才能使其正常工作。

于 2013-03-06T17:17:34.180 回答