Tuesday, March 27, 2012

derived column transformation expression

Hi.

I am using the following expression to check if the first charcter of a string is not the letter "E" and if it is, strip it off by selecting the remainder of the string:

SUBSTRING([Derv.comno],1,1) == "E" ? SUBSTRING([Derv.comno],2,10) : [Derv.comno]

This is ok in 99.9% of cases, but ideally I would like to be able to check, and alter the string if the first charcter is anything but numeric

I had something like this in mind:

SUBSTRING([Derv.comno],1,1) != ("1","2","3") ? SUBSTRING([Derv.comno],2,10) : [Derv.comno]

but the syntax is incorrect.

Could you tell me if what I am attempting is actually possible, and if so, point me in the right direction regarding the syntax!

Thanks

CODEPOINT(@.[User::CCC]) >= 47 && CODEPOINT(@.[User::CCC]) <= 57 ? @.[User::CCC] : SUBSTRING(@.[User::CCC], 2, LEN(@.[User::CCC]) - 1)|||

Excellent, works a treat!

Thanks very much

sql

No comments:

Post a Comment