SSIS VS2012将平面文件文本转换为布尔值

时间:2015-09-17 13:54:58

标签: sql-server visual-studio-2012 ssis

我正在尝试从CSV中获取数据并将记录导入我的数据库。我有一个SSIS包,读取平面文件,通过数据转换传递,然后将其发送到数据库。

enter image description here

enter image description here

我遇到的问题是具有“True”“False”或空白的字段需要转换为布尔值。这个包在过去有效,但我们已经从SQL 2008升级到SQL 2014,并从VS2008升级到VS2012。

错误:

Error: 2015-09-15 23:00:03.23
Code: 0xC02020C5     
Source: Data Flow Task 1 Data Conversion 0 - 0 [2]     
Description: Data conversion failed while converting column "aginactive" 
             (192) to column "aginactive" (62).  The conversion returned 
             status value 2 and status text "The value could not be 
             converted because of a potential loss of data.".  
End Error  

Error: 2015-09-15 23:00:03.23
Code: 0xC0209029      
Source: Data Flow Task 1 Data Conversion 0 - 0 [2]     
Description: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The 
             "Data Conversion 0 - 0.Outputs[Data Conversion Output].
             Columns[aginactive]" failed because error code 0xC020907F 
             occurred, and the error row disposition on "Data Conversion 
             0 - 0.Outputs[Data Conversion Output].Columns[aginactive]" 
             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.  
End Error   

Error: 2015-09-15 23:00:03.23     
Code: 0xC0047022     
Source: Data Flow Task 1 SSIS.Pipeline     
Description: SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput 
             method on component "Data Conversion 0 - 0" (2) failed with 
             error code 0xC0209029 while processing input "Data Conversion 
             Input" (3). 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.  
End Error  

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

使用派生列转换,而不是数据转换转换。使用Inline IF创建一个新的布尔列,以便输入值为" True"它输出1,否则为0.然后使用目的地中的新列。