Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Derived Column - DT_STR to DT_Decimal

$
0
0

HI,

I have a column Score, which comes with in 100% or 100.00% etc. 

Now if the someone puts "One hundred %" instead of one of the above two, I want to fail the task. I am trying to figure out derived column scenario and trying to convert DT_STR (source "Score" datatype) into DT_Decimal (destination "Score%" datatype).

When I use the following expression

(ISNULL((DT_STR, 7, 1252)([Score])) || TRIM((DT_STR, 7, 1252)([Score])) == "") ? NULL(DT_DECIMAL,2) : (DT_DECIMAL,2) (REPLACE((DT_STR, 7, 1252)([Score]), "%", ""))


, my final datatype is of numeric...I want it to be decimal.

Where am I screwing this up? I think by getting this working, if someone puts invalid value for Score, it will fail the component/pkg as you cannot convert text to decimal.

Thank you

P.S. Do I need to have "Scale" defined while converting to DT_Decimal? I am putting 7 character limit so 100.00% will convert to 100.00.


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>