Reputation: 1404
I created SSIS package. I have a Data Flow Task in here, where I have OLE DB DataSource, which loads records from some table from database. Table name is assigned programmatically, so different columns may be output of that DataSource. Also I have Conditional Split connected to DataSource output, where I want to split records. I want to set condition in Conditional Split and I want to do something like that:
@[User::ConditionColumnName] >= @[User::SomeValue]
where @[User::SomeValue] is variable with some value to compare, but @[User::ConditionColumnName] is variable with name of some column from DataSource output. This value I will assign programmatically. How can I do that? Or may be is there some other way to split data with unknown at compile time columns?
Upvotes: 0
Views: 2730
Reputation: 3957
This sounds like a row-based conditional split. Perhaps you could add the variable value into your select list (so that you have a column you can compare on) something like
"SELECT '" + (DT_STR,50,1252)@[User::ConditionColumnName] + "' as MyConditionColumnName, .... FROM ... "
That way you have the column MyConditionColumnName per row that you can compare on in your Conditional Split.
(You could put this select into a variable and run the sql from variable, maybe easier to maintain) - either way you need to parse the query as an expression in order to evaluate your variable before it's run.
Upvotes: 2