January 31, 2013 at 3:40 pm
SSIS SQL 2008
My objective is to monitor a directory for new CSV files, output a new file that replaces the commas in the CSV with | (pipes) and changes from a CSV extension to TXT, then archive the unmodified/original CSV file.
My directory structure looks like this:
-MainDropFolder (where initial CSV is dropped)
--Archive (where the original CSV file will be moved to from Processing at end of package)
--Processing (where CSV from main drop gets moved to at start of package)
--Ouput (where the new TXT file with | delimiter should be placed)
I have built the package accomplishing all of these steps except the changing of the delimiter. My current Control Flow looks like this:
1. Script Task (Watch for incoming file)
2. File System Task (Move data file to processing directory)
3. File System Task (Copy to Output and rename as txt)
4. File System Task (Move processed file to Archive directory)
What is the best way to go about changing the comma delimiters to | (pipes)? I'm thinking it needs to be done within another Script Task, but I am not well-versed in C# to accomplish this.
February 1, 2013 at 1:26 am
This thread has several solutions:
http://stackoverflow.com/questions/7243751/how-replace-all-spaces-in-a-text-file-with-one-character
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
February 1, 2013 at 6:16 am
And here is an article on how to watch a directory for incoming files using a Script Task.
Using the Script Task in SSIS to Process Data Files When They Arrive[/url]
The articles uses Excel files in the demo but it accepts a file-mask so just adjust the variable values to suit your needs.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
February 1, 2013 at 7:20 pm
Thanks, Koen. I'll see if I can use a suggestion in that thread. And OPC, that was the exact article I used to build the watcher task. The code he used was only valid for 2012, not 2008, but he posted the code for 08 in the comments. Very helpful.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy