SSIS OLE DB 错误问题

SSIS OLE DB Error Issues

在过去的一周里,我一直致力于在 SSIS 中创建一个包,该包将提取、转换数据,然后将数据从 Access 数据库加载到 SQL 服务器数据库中。最初,我创建了两个单独的包来处理从 Access 中的相同 table 迁移数据位,对其进行转换,然后将其加载到 SQL 服务器中的两个不同的 table。那些单独工作,但现在我试图将它们折叠成一个包。

根据我的调查,这是非常可行的(有一个数据流的包有两个源和目的地)但由于某种原因我无法让它工作。查看我得到的错误代码,人们建议使用数据转换,但我以前曾遇到过有关使用数据转换解决的数据类型的错误。

我运行打包时SSIS抛给我的错误如下:

Error: 0xC0202009 at Data Flow Task, InfoTable [52]: 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 11.0"  Hresult: 0x80004005  Description: "Unspecified error".
Error: 0xC020901C at Data Flow Task, InfoTable [52]: There was an error with InfoTable.Inputs[OLE DB Destination Input].Columns[Copy of Parameter] on InfoTable.Inputs[OLE DB Destination Input]. The column status returned was: "The value violated the integrity constraints for the column.".
Error: 0xC0209029 at Data Flow Task, InfoTable [52]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "InfoTable.Inputs[OLE DB Destination Input]" failed because error code 0xC020907D occurred, and the error row disposition on "InfoTable.Inputs[OLE DB Destination Input]" 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.
Error: 0xC0047022 at Data Flow Task, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "InfoTable" (52) failed with error code 0xC0209029 while processing input "OLE DB Destination Input" (65). 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.

提前感谢您提供的任何帮助!

如果没有详细了解所有内容,我不能肯定地说,但根据错误和您对问题的描述,我怀疑您有外键关系,并且其中一些数据在主键之前加载被加载。如果是这样,请考虑添加优先约束以加载第一个 table,然后在同一包中使用两个单独的数据流加载第二个。

我想通了;这是由于我试图加载的数据包含一些空值。通常这会很好,但是我的 SQL 服务器数据库(特别是数据正在加载到的 table)被设置为不允许空值。我相信这就是导致问题的原因,即使 OLE DB 目标上的 "allow nulls" > table 或视图 - 已检查快速加载。

解决方案似乎是修复 SQL 服务器 table 以接受空值或不尝试将空值加载到 table。我做了后者,一切正常(甚至不需要数据转换)。