SSIS Destination 组件使用Fast-Load mode出错

时间:2021-09-11 21:14:45

查看一个Package的历史Message 数据,发现 DataFlow Task 经常出错,错误信息的Description是:

Description: "While reading current row from host, a premature end-of-message was encountered--an incoming data stream was interrupted when the server expected to see more data. The host program may have terminated. Ensure that you are using a supported client application programming interface (API).".

错误原因是:使用Fast-Load 将数据导入到Nvarchar(max)或varchar(max) column中时,会出现错误。

当Destination组件使用Fast-Load 模式时,实际上,SQL Server 使用bulk insert 来插入数据。如果Targe table 存在 nvarchar(max) 或 varchar(max) column,SSIS 使用bulk insert 会出现错误。

在《Error in SSIS Data Flow when using Fast Load》中,说到使用Computed Column 也会导致 Fast-Load 出现错误,经本人测试,不会出现错误。

参考doc:

Bulk Load Fails with nvarchar(max)

Unable to Bulk Insert with NVARCHAR(MAX) Column

Bulk load error: While reading current row from host, a premature end-of-message was encountered.