Home Forums SQL Server 2005 Business Intelligence SSIS File Rename - The process cannot access the file because it is being used by another process RE: SSIS File Rename - The process cannot access the file because it is being used by another process

  • I was unable to ascertain to a certainty when the package lets the files go. Either way, the fact that they were being locked was indisputable I guess.

    Adding any one of the several creative methods to "wait" did no good either. The files were locked until the package execution was finished, it seemed.

    I eventually solved my problem like this:

    1. in the ForEach loop, after processing the file into SQL table, I simply COPIED the file...That worked, locks notwithtanding.

    2. in the same loop, execute a stored procedure to insert a value into a table saying the file was Processed, not yet Deleted.

    3. create a new package running independently from the first one (but slightly after it each morning), that opens an data flow (ado source - files not yet deleted, recordset destination), and loops through it, updating a variable and using a simple script task to delete the file. and executing a SP to say file is now deleted. (yes there is the Filesystem delete file task, but it's so buggy in terms of Source and Variables that it's easier to just write a 3-line script task..)

    Works like a champ, I guess I'm OK with this for now. Have researched this SSIS file locking thing to no end, and none of the posted solutions have worked for me...(Waits, Separating tasks/steps, Separating foreach containers, etc).....But there is a group of people who seem to have issues still and no solution; guess I'm in there with them.