June 6, 2013 at 1:49 pm
I am new to SSIS. There is a data flow task for a derived column. I want to have a Derived Column that only looks at the characters after a hypen, and then eliminates any leading or ending spaces.
For example: Some Descriptive Text - characters
I would like it to just return: characters
(with no leading or ending spaces)
Not sure how to accomplish this in a SSIS drived column expression. Any help will be greatly appreciated. Thank you.
June 6, 2013 at 2:46 pm
cherbik (6/6/2013)
I am new to SSIS. There is a data flow task for a derived column. I want to have a Derived Column that only looks at the characters after a hypen, and then eliminates any leading or ending spaces.For example: Some Descriptive Text - characters
I would like it to just return: characters
(with no leading or ending spaces)
Not sure how to accomplish this in a SSIS drived column expression. Any help will be greatly appreciated. Thank you.
In the expression builder, you'll see the available string manipulation functions.
You'll want substring() to remove the front portion. Findstring() to locate the hyphen. LEN() to determine how far to go in the substring(). LTrim()/RTrim() to clean off leading/trailing spaces.
So, in the end, it looks a bit like this:
LTRIM( RTRIM( SUBSTRING( ColA, FINDSTRING( ColA, "-", 1), LEN(ColA) - FINDSTRING( ColA, "-", 1))))
I didn't test it directly so adjust accordingly.
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
June 7, 2013 at 8:28 am
Thank you so much. You made it very easy to understand.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply