Search code examples
c#.netsql-serverssis

SSIS - The process cannot access the file because it is being used by another process


I have following Dataflow:

enter image description here

Control:

enter image description here

I just wanted to copy all the data from flatfiles in sourcefolder to sql database and after copying move those files to folder named Done.

But when i run this, i get error:

[File System Task] Error: An error occurred with the following error message: "The process cannot access the file because it is being used by another process.".

Data gets copied to sqlserver , but file does not moves.

My process tab is as follows:

enter image description here


Solution

  • This may be too obvious, but have you tried inserting a short delay to give the dataflow time to let go of the file? For example, insert an Execute SQL Task with contents like:

    -- Wait for 1 second
    WAITFOR DELAY '00:00:01'
    

    Alternatively, you could handle the Failure Path and retry, perhaps after a delay.