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

can't move a file in an OnError event handler due to file lock

$
0
0

Can someone please try this and let me know if they can replicate this. And can someone explain why this happens?

Create a Data Flow Task. In it, create a Flat File Source and OLE DB Destination and load some data from a file to a SQL table. Put in some bad data so that the load will fail.

Create an OnError event handler on the Data Flow Task and put a File System Task to move the file from the source folder to another folder.

Does your File System Task fail saying "The process cannot access the file because it is being used by another process"? This is what is happening to me and I am not sure why.

Next, on a hunch, rather than OnError I did the File System Task on OnTaskFailed and that works. 

So, what's going on here? I know there is a subtle difference between the two events from what I've read, but I don't quite get it. Can someone explain what may be happening in this example... why the file doesn't move in OnError but does move in OnTaskFailed.


Viewing all articles
Browse latest Browse all 24688

Trending Articles



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