SSIS For Each File 循环和文件系统任务复制文件
我在 for every 循环容器内使用文件系统任务,如下所述: 链接文本
但是,当我执行该包时,出现此错误: [文件系统任务] 错误:发生错误,并显示以下错误消息:“该进程无法访问文件“C:\Book1.xlsx”,因为该文件正在被另一个进程使用。”。
我没有打开该文件,并且我假设其他人也没有打开该文件,因为我能够复制、打开和覆盖该文件。
任何建议将不胜感激。 如果您想要一个示例包,请告诉我。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经找出问题所在了。确保不要创建文件连接(您可以在“连接管理器”选项卡中看到它们),这些连接与文件系统任务中用于源文件的路径保持相同的变量。
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.
由于这花了我很多小时来解决,所以我将我的解决方案发布给其他人。这非常简单...
将 Excel 文件的副本放在另一个文件夹中,并将其命名为“template.xlsx”。让您的架构连接指向此副本。实际的 Excel 文件将不再被 ForEach 工作表架构循环锁定!
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!