Solved

SSIS: Can't Get Source CSV File To Move when Failure in Data Flow Task

Posted on 2011-02-19
15
702 Views
Last Modified: 2012-05-11
Inside my data flow task I have a Source File and a Destination OLE DB.  Outside this, in the control flow, I have my data flow task, on Failure (red line), configured to move the files to a "failure" directory where I archive.  

When I run the job, and for some reason a row in the CSV has an extra comma the entire SQL Job fails (I'm running SSIS via a sql job), no "failed" files move to the failed directory and I'm basically dead in the water.

I've tried configuring inside the data flow task but there is no option for file operations.  I've attached a screen shot of the Control Flow and Data Flow tasks.  


ControlFlow.jpg
DataFlow.jpg
0
Comment
Question by:davidcahan
  • 8
  • 7
15 Comments
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 500 total points
ID: 34934174
You will have to add a task to "clean up" the data prior to doing the data transfer task.
0
 

Author Comment

by:davidcahan
ID: 34934254
Could I not use an Event Handler?
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 34934431
The Data Flow task in SSIS will fail as the data does not have the correct format.
0
Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

 

Author Comment

by:davidcahan
ID: 34934473
so the onError event handler for the data flow task won't allow me to trap that and then move the file over to my failed files directory.

sorry, I'm not intentionally being dense.  Firstly, I'm just confirming what I believe to know about event handlers and also, trying to figure out every possible way I might have to clean up the data could be difficult.  currently, it's choking on this

"1","2","foo"
                   "2","1","foo"
"3","2","foo"

as you can see there is a line of data that is either tabbed way over or something similar.  I wouldn't even know how to clean that.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 34935230
>>so the onError event handler for the data flow task won't allow me to trap that and then move the file over to my failed files directory.<<
It should, but I honestly do not know for sure.  Hopefully someone will step up to the plate.

0
 

Author Comment

by:davidcahan
ID: 34935287
if I were going to clean the data first, any suggestions on how to handle the sample "bad data" I outlined above?
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 500 total points
ID: 34935573
Open the file, read all the lines and write them out to a new file, when you get to one that starts with a tab, replace it with an empty string.
0
 

Author Comment

by:davidcahan
ID: 34937408
hmmmm...ok.  thanks
0
 

Author Comment

by:davidcahan
ID: 34937484
can you tell me the basic ssis controls I will need to do that?
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 500 total points
ID: 34939144
You can use the Script Task to do this.
0
 

Author Comment

by:davidcahan
ID: 34939254
thanks for all your help!
0
 

Author Comment

by:davidcahan
ID: 34939276
by the way, the onError event does work theoretically.  but in practice, a process holds on to the file and the file move errors out.  I either need to fix the file as you suggest or figure out how to kill the process holding the file so that it can be moved.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 34939338
>>the onError event does work theoretically.  but in practice, a process holds on to the file and the file move errors out.<<
That is good to know.  Thank you.
0
 

Author Comment

by:davidcahan
ID: 34944321
do you think my script task can attempt to overwrite the original file?  otherwise, how do I reset the File Variable name in the ForEach loop container?
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 34949060
No.  You should not do that.  You need to write to a new file.  If you cannot change the File Variable, then when you are done, delete the original and rename the new one.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question