Question : Script In SSIS

I'm having issues transforming a flat file into SSIS 2008.  It is a .CSV file with " as the text delimiter.  The problem is that within some of that text it will have descriptions such as for column Description will have descriptions that say 19" Tape ect...  The problem is that it will pick that description up as the text delimiter and not transform correctly.  I thought if I had a script component in SSIS that would strip every " from the file before it transforms then it would work correctly.  Does anyone have a script that would do that?

Answer : Script In SSIS

this script will perform a replace on specified file
paste it inside script task before data flow task

if you need to perform this on a whole directory of these files then a loop must be add inside the code
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
public void Main()
        {
            System.IO.StreamReader sr = new System.IO.StreamReader(@"C:\Users\Reza\Downloads\test(2).csv");
            string str1=(char)34+","+(char)34;
            string str2=(char)34+"|"+(char)34;
            string strContent = sr.ReadToEnd().Replace(str1, str2);
            sr.Close();
            sr.Dispose();


            System.IO.StreamWriter sw = new System.IO.StreamWriter(@"C:\Users\Reza\Downloads\test(2).csv",false);
            sw.Write(strContent);
            sw.Flush();
            sw.Close();
            sw.Dispose();

            // TODO: Add your code here
            Dts.TaskResult = (int)ScriptResults.Success;
        }
Random Solutions  
 
programming4us programming4us