[英]SSIS load 2 columns of a flat file (first non null only) into a variable
I have a flat file with the following columns 我有一个带有以下各列的平面文件
SampleID Rep_Number Product Protein Fat Solids SampleID Rep_Number产品蛋白质脂肪固体
In the flat file SampleID and Product are populated in the first row only, rest of the rows only have values for Rep_Number, Protein, Fat, Solids. 在平面文件中,SampleID和Product仅填充在第一行中,其余行仅具有Rep_Number,蛋白质,脂肪,固体的值。 SampleID and Product are blank for the rest of the rows.
其余行的SampleID和Product为空白。 So my task is to fill those blank rows with the first row that has the sampleID and Product and load into the table.
因此,我的任务是用具有sampleID和Product的第一行填充这些空白行,然后加载到表中。
So task is to pick the first non null SampleID and Product from the flat file and put them in a variable. 因此,任务是从平面文件中选择第一个非null的SampleID和Product并将其放入变量中。 And rest is all configured.
其余的都配置好了。 If I can pick the first non null SampleID and Product directly from the flat file and put into their respective variables I can take it from there.
如果我可以直接从平面文件中选择第一个非null的SampleID和Product并将其放入各自的变量中,则可以从那里获取它。 That is all I need.
这就是我所需要的。
I can connect a script component to flat file source in a data flow task. 我可以在数据流任务中将脚本组件连接到平面文件源。 I need help with the script to pick the first non null values (SampleID and Product),
我需要有关脚本的帮助,以选择第一个非null值(SampleID和Product),
Need help please. 请需要帮助。 Thanks in advance.
提前致谢。
If you are sure you need to store the data of the 1st row - 1st 2 columns' values in variables and take it from there, and DO NOT REQUIRE a change in your original approach, then try this: 如果您确定需要将第一行-第一两列的值存储在变量中,然后从那里获取,并且不需要更改原始方法,请尝试以下操作:
Under the Public Overrides Sub PostExecute() {} procedure type this: 在Public Overrides Sub PostExecute(){}过程下,键入以下内容:
If Variables.Row_Count = 0 Then 如果Variables.Row_Count = 0则
Variables.Your_Variable1 = Row.Column_Name1 Variables.Your_Variable1 = Row.Column_Name1
Variables.Your_Variable2 = Row.Column_Name2 Variables.Your_Variable2 = Row.Column_Name2
Variables.Row_Count= Variables.Row_Count + 1 Variables.Row_Count =变量.Row_Count + 1
End If 万一
You have the desired values in your variables, proceed with the rest of your logic. 您的变量中有所需的值,请继续执行其余的逻辑。
Note: 注意:
Please mark my post as answer if it helps :) 如果有帮助,请标记我的帖子为答案:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.