执行时 OLE DB 目标的 SSIS 错误

SSIS Error with OLE DB destination when executing

我是 SSIS 新手,所以一直在学习一些在线教程。我遇到了以下情况,无法弄清楚发生了什么。错误是 OLE DB 连接

如果有人能指出正确的方向来解决这个问题,那就太好了。

SSIS package "c:\users\****\documents\visual studio 2015\Projects\tutorials\tutorials\basicpackage.dtsx" starting.
Information: 0x4004300A at Data Flow Task, SSIS.Pipeline: Validation phase is beginning.
Information: 0x4004300A at Data Flow Task, SSIS.Pipeline: Validation phase is beginning.
Warning: 0x80049304 at Data Flow Task, SSIS.Pipeline: Warning: Could not open global shared memory to communicate with performance DLL; data flow performance counters are not available.  To resolve, run this package as an administrator, or on the system's console.
Information: 0x40043006 at Data Flow Task, SSIS.Pipeline: Prepare for Execute phase is beginning.
Information: 0x40043007 at Data Flow Task, SSIS.Pipeline: Pre-Execute phase is beginning.
Information: 0x402090DC at Data Flow Task, Flat File Source [2]: The processing of file "L:\sql queries\SSIS TUTORIAL\apps.txt" has started.
Information: 0x4004300C at Data Flow Task, SSIS.Pipeline: Execute phase is beginning.
Information: 0x402090DE at Data Flow Task, Flat File Source [2]: The total number of data rows processed for file "L:\sql queries\SSIS TUTORIAL\apps.txt" is 5.
Error: 0xC0202009 at Data Flow Task, OLE DB Destination [23]: 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: "The statement has been terminated.".
An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80004005  Description: "Cannot insert the value NULL into column 'ID', table 'ssis.dbo.Apps'; column does not allow nulls. INSERT fails.".
Error: 0xC0209029 at Data Flow Task, OLE DB Destination [23]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "OLE DB Destination.Inputs[OLE DB Destination Input]" failed because error code 0xC020907B occurred, and the error row disposition on "OLE DB Destination.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 "OLE DB Destination" (23) failed with error code 0xC0209029 while processing input "OLE DB Destination Input" (36). 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.
Information: 0x40043008 at Data Flow Task, SSIS.Pipeline: Post Execute phase is beginning.
Information: 0x402090DD at Data Flow Task, Flat File Source [2]: The processing of file "L:\sql queries\SSIS TUTORIAL\apps.txt" has ended.
Information: 0x4004300B at Data Flow Task, SSIS.Pipeline: "OLE DB Destination" wrote 4 rows.
Information: 0x40043009 at Data Flow Task, SSIS.Pipeline: Cleanup phase is beginning.
Task failed: Data Flow Task
Warning: 0x80019002 at basicpackage: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED.  The Execution method succeeded, but the number of errors raised (3) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
SSIS package "c:\users\****\documents\visual studio 2015\Projects\tutorials\tutorials\basicpackage.dtsx" finished: Failure.

第一个错误 ii 无法解决。我已经检查了 SQL 数据库中的连接、目标 table,但不知道问题出在哪里。可能与 Windows 访问数据库的身份验证有关吗?

Error: 0xC0202009 at Data Flow Task, OLE DB Destination [23]: 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: "Cannot insert the value NULL into column 'ID', table 'ssis.dbo.Apps'; column does not allow nulls. INSERT fails.".

在不知道文件内容的情况下L:\sql queries\SSIS TUTORIAL\apps.txtSSIS.dbo.Apps table 的设计很难指出问题的确切区域,除了说 table 有一个名为 ID 的列,它不接受NULL 并且文件有一行,其中相应列的内容具有 NULL .

[编辑} 根据 OP 的评论更新

你好像有一个table这样的

CREATE TABLE dbo.Apps (
      Id    UNIQUEIDENTIFIER PRIMARY KEY
    , Apps  CHAR (1)
    , Rating CHAR   (1)
    , Summary CHAR  (1)
);

并尝试插入类似这样的内容,Id 列中没有任何内容

INSERT INTO dbo.Apps
( Id, Apps, Rating, Summary)
VALUES
(NULL , '1', '2', '3' ) 

你会得到这个错误

Msg 515, Level 16, State 2, Line 5 Cannot insert the value NULL into column 'Id', table 'xStuff.dbo.Apps'; column does not allow nulls. INSERT fails.

所以我建议您像这样更改 table 定义,因为您希望 ID 列自动递增,UNIQUEIDENTIFIERINT IDENTITY

CREATE TABLE dbo.Apps (
      Id    INT IDENTITY PRIMARY KEY
    , Apps  CHAR (1)
    , Rating CHAR   (1)
    , Summary CHAR  (1)
);

这会起作用

INSERT INTO dbo.Apps
(     Apps
    , Rating
    , Summary
)
VALUES
(  '1', '2', '3'), (  'A', 'B', 'C')

查看输出