读取带有可选附加列的 SSIS 包中的平面文件

Read flat file in a SSIS package with optional additional columns

在 SSIS 包中,我有一个平面文件,该文件可能有七列或最后两列额外的九列。

示例文件 1:

StoreId,Overall Service Score,FindingHelp,Friendly,PaySpeed,GoodTarget,ExceptionalTarget
0286,0.84,0.79,0.90,0.84,0.81,0.81
0014,0.76,0.75,0.77,0.77,0.84,0.99

示例文件 2:

StoreId,Overall Service Score,FindingHelp,Friendly,PaySpeed,GoodTarget,ExceptionalTarget,PPU_OverallScore,PPU_Target
0286,0.84,0.79,0.90,0.84,0.81,0.81,0.8,0.6
0014,0.76,0.75,0.77,0.77,0.84,0.99,0.9,1

是否可以在 SSIS 包中处理这些文件的两个版本?如果可以,如何处理?

我已经创建了一个数据流,例如 file2。但是,当尝试使用 file1 时,出现以下错误:

[Flat File Source [19]] Error: An error occurred while skipping data rows.
[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on Flat File Source returned error code 0xC0202091.  The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.  There may be error messages posted before this with more information about the failure.

我的条件流程:

更新:附加截图:

您可以通过修改条件拆分任务的表达式并添加 ISNULL() 函数和立即 if 条件表达式来处理 NULL 来轻松解决此问题。

沿着以下:

ISNULL(PPU_Target) ? "" : PPU_Target 
ISNULL(PPU_OverallScore) ? "" : PPU_OverallScore