2017-10-13 379 views
0

我是SSIS的新手,所以一直在关注一些在线教程。我遇到以下情况,无法弄清楚发生了什么。错误是与OLE DB连接执行OLE DB目的地时出现SSIS错误

如果任何人都可以指出我正确的方向来解决这将是伟大的。

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 DB中的目标表并且不知道问题是什么。是否可以使用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. 
+0

包含文件'apps.txt'的内容和'dbo.Apps'表的定义 –

+0

'“不能将值NULL插入'ID''列。删除ID列的NOT NULL限制(不推荐),或者检查源代码中的NULL。 –

+0

@ Prabhat-G我想如果我不在连接管理器的映射部分将任何东西链接到数据库列“ID”,那么就不会有问题。 'ID'列会自动增加? – sql2015

回答

1

这个错误看起来是由该线路输出

的OLE DB记录说明。源:“Microsoft SQL Server本机 客户端11.0”Hresult:0x80004005描述:“不能插入 值NULL到列'ID',表'ssis.dbo.Apps';列不允许空值 INSERT失败。

不知道该文件L:\sql queries\SSIS TUTORIAL\apps.txt 和设计SSIS.dbo.Apps表难以针点比其他问题的确切面积地说,表中有一个名为ID不接受空值列的内容并且该文件具有一行,其中相应列的内容具有空值。

[编辑} 更新如下OP的评论

你似乎有一个表像这样

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不能将值NULL插入 列'Id',表'xStuff.dbo.Apps';列不允许有空值。 INSERT失败。

因此,我建议您更改表定义像这样,只要你想的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') 

查看输出

enter image description here

+0

感谢您的回复。我的apps.txt文件包含3个标头App |评分|总结。我的SQL数据库表APPs包含4列ID | App | Rating | Summary。 ID被设置为PK并且数据类型被设置为uniqueIdentifier,这意味着它不允许空值。我不认为这会是一个问题,我认为这会在包运行时填充。 – sql2015

+0

uniqueidentifier不会自动增加,也不会有默认值,除非您创建默认约束 –