SSIS For Each File Loop and File System Task to copy Files

試著忘記壹切 提交于 2019-12-02 02:22:13

问题


I'm using a files system task inside a for each loop container, just as described here: link text

However, when I execute the package I get this error: [File System Task] Error: An error occurred with the following error message: "The process cannot access the file 'C:\Book1.xlsx' because it is being used by another process.".

I do not have the file open, and I assume no one else does, as I am able to copy, and open, and overwrite the file.

Any suggestions would be appreciated. If you want an example package plz let me know.


回答1:


I've figured out the problem. Be sure to not create File connections(you can see them in the Connection Managers tab) that hold on to the same variable as the path you are using for the source file, in the File System Task.




回答2:


Since this took me MANY HOURS to solve, I'm posting my solution for others. And it was sooo simple...

Place a copy of your Excel File in another folder and name it "template.xlsx". Have your Schema connection point to this copy. The actual Excel file will no longer be kept locked by the ForEach Worksheet Schema loop!



来源:https://stackoverflow.com/questions/2758209/ssis-for-each-file-loop-and-file-system-task-to-copy-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!