I have condition where I need to feed conditional split result based on condition (will be just one int value) to variable. Can some one help how to do this?
My actual package (Data flow):
XML Source
--> Conditional split
(based on condition) 2 outputs..one result based on condition (will be just one int value) need to pass it on to variable. How to achieve this?
纯SSIS方式-将数据流消耗到Recordset目标中 ,然后使用ForEach循环遍历它,将值分配给所需的变量。
you have to use a script component to achieve this:
ReadWrite
Variable. ( in my example the variable is named Result Inside the script window write the following code
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer) If Not Row.inColumn_IsNull Then Variables.Result = Row.inColumn End If End Sub
Side Note: Variable value does not change before dataflowtask
execution is finish, to use the new value you have to continue your work in another dataflowtask
I know two ways to realize this.
First: Do it with a C# script component, this is the easiest way. Just put a script component behind your conditional split, select your variable as "ReadWrite", then set it like that in the code:
Dts.Variables["yourvariable"].Value = Input0Buffer.Yourcolumn
I don't have access to SSIS right now, so I can't give you the exact code, but this should get you started.
Second: Write to a table and read it back with Execute SQL task. I don't really like this way ;-)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.