CASE
WHEN CHARINDEX('%', '{FixedARMRateReductionLimit}') > 0 THEN
CAST(SUBSTRING('{FixedARMRateReductionLimit}', 0,
CHARINDEX('%', '{FixedARMRateReductionLimit}')) as decimal)/100
WHEN '{FixedARMRateReductionLimit}' = 'Weekly PMMS Rate' THEN
PARAM_VAL_TXT
ELSE
.02
END
CASE WHEN CHARINDEX(‘%’, ‘{FixedARMRateReductionLimit}’) > 0 THEN CAST(SUBSTRING(‘{FixedARMRateReductionLimit}’, 0, CHARINDEX(‘%’, ‘{FixedARMRateReductionLimit}’)) as decimal)/100 WHEN
Share
The moral of the following story is that just because you can do something in SSIS, it’s not always a good idea.
Case in point, this query. It would be far more efficient to use the existing sql logic to generate the final value than using derived columns or a script task in SSIS (not to mention the waste of pipeline memory, CPU, etc)
Source query
I used the following as a source query.
Find Percent Position
Determine whether a percentage symbol exists in the column. This creates an column called
PercentPositionCheck for rate text
It should be sufficient to do a simple comparison as the first expression shows but I was having issues with it. I assume it’s a string conversion/comparison issue (see first Note). Rather than diddle with getting a boolean value, I used findstring to generate the ordinal position.
Derive Output
Enjoy the double usage of the Ternary operator.
You could have simplified some of this in a script task but I’d just do the logic in the source.