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

Using the script component to cleanse data

$
0
0

I am relatively new to SSIS.

I have a SQL Server source and need to strip out all types of puncuation and empty space before I send it to my flat file destination.

I am using the Script component becuase it seems like this is a very powerful transform and learning it will give me lots of power and flexabilty on future projects.

Below is my C# script that clears out some types of puncuations, but I have seen better methods when I google "C#, Strip punuation from Strings", the only problem is I can't get them to work.

I thought I would post  the code I have thus far and see if anyone can improve on it.  I will post my improvemetns as I get them to work.

My next step is to use the Trim function to remove leading and trailing spaces if they exsist.

Any ideas or suggeston appreciated.

Mike

 public override void Input0_ProcessInputRow(Input0Buffer Row)
    {
        if (Row.Col3.Contains("."))
        {
            Row.test = Row.Col3.Replace(".", "");
        }
        else if (Row.Col3.Contains("-"))
        {
            Row.test = Row.Col3.Replace("-", "");
        }
        else if (Row.Col3.Contains(","))
        {
            Row.test = Row.Col3.Replace(",", "");
        }
        else
        {
            Row.test = Row.Col3;
        }
    }
}


Viewing all articles
Browse latest Browse all 24688

Trending Articles



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