Expression in derived column
Hi,
I want to write an expression in derive column
If column contain string in that there is any character that is not equal to (a to z) or (A to Z) or (0 to 9) than it should have to replace by space
for example colA 87$#!*dghAB so ans should be colA 87dghAB
September 20th, 2011 3:43pm
This exact functionality is mire suited for a Script Component set as a Transformation in which you can employ RegEx, coding such an expression in the Derived Column Transformation will require a long string that will be difficult to make and verify using
the conditional check as ? :
The closest and easiest IMHO you can come would be nested checks as:
REPLACE((REPLACE(InputCol1,"!"," ")),"@"," ")
Just keep nesting REPLACEs covering different chars.
Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
September 20th, 2011 4:13pm
you could use a regular expression in a Script Component. Just find the right pattern. Here is an example:
http://microsoft-ssis.blogspot.com/2011/03/cleaning-with-regular-expressions-in.htmlPlease mark the post as answered if it answers your question | My SSIS Blog:
http://microsoft-ssis.blogspot.com
September 20th, 2011 4:25pm
Hi ArthurZ
I dont know how to write in script can you please tell me how to write it
Thanks,
-Mayur
Free Windows Admin Tool Kit Click here and download it now
September 20th, 2011 5:43pm
I have found you a close enough example:
http://microsoft-ssis.blogspot.com/2011/03/cleaning-with-regular-expressions-in.html you will need to build or find the right RegEx expression.
There is a wealth of RegEx expressions here: http://regexlib.com/.
I also forgot that there are numerous RegEx components for SSIS, so you may "escape" without coding at all. E.g. http://www.sqlis.com/post/Regular-Expression-Transformation.aspx
And there are more on CodePlex http://ssisctc.codeplex.com/, I have not tried either one, but I assume it must be really trivial to set one up.
Arthur My Blog
September 20th, 2011 5:53pm