Regex Task?
I have a field in my table that in my transformation I like to replace all characters except (letters,digits,space and hyphen) with "". Is it possible to do that in SSIS package and possibly though regex? Thanks for your time in advance.
April 13th, 2007 6:47pm

You can for sure write your own script component to perfom the transformation in the data flow. I know there are a 3rd party SSIS component out there but as far as I know it is not free.
Free Windows Admin Tool Kit Click here and download it now
April 13th, 2007 7:59pm

Here's a regular expression for that pattern. For the Transform itself, make sure the column (or columns) to transform have a Usage Type of Read/Write. Code Snippet Imports SystemImports Microsoft.SqlServer.Dts.Pipeline.WrapperImports Microsoft.SqlServer.Dts.Runtime.WrapperImports System.Text.RegularExpressionsPublic Class ScriptMainInherits UserComponent' Any character that is NOT in this class: [a-zA-Z0-9 -]Private pattern As Regex = New Regex("[^a-zA-Z0-9 -]", RegexOptions.IgnoreCase)Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)If Not Row.GeneratedStr1_IsNull ThenRow.GeneratedStr1 = pattern.Replace(Row.GeneratedStr1, String.Empty)End IfEnd SubEnd Class
April 13th, 2007 8:21pm

I was able to find a free downloadable component for regex from Microsoft. See below for the link - http://www.microsoft.com/downloads/details.aspx?FamilyID=c16f11ad-150a-4091-b3a2-83d21d3e0973&displaylang=en
Free Windows Admin Tool Kit Click here and download it now
August 22nd, 2008 3:53pm

Here is an other example of cleaning column values with a Script Component and a regular expression: http://microsoft-ssis.blogspot.com/2011/03/cleaning-with-regular-expressions-in.html Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com
March 5th, 2011 8:01am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics