How to prevent Excel import in SSIS package when there is no file to process?

冷暖自知 提交于 2021-02-10 05:15:39

问题


I have an SSIS package that imports Excel files. Inside the package, I have a Script task that checks whether the Excel file exists or not before executing the Excel import process.

I am unable to execute the package when the Excel file doesn't exist because of the AcquireConnection error.

How can I prevent the package from executing when there is no Excel file available for import?


回答1:


Perform the following steps to avoid the package from failing.

  • Set the ValidateExternalMetadata property on the Excel Source to False.
  • Set the DelayValidation property on the Excel Connection to True.

The package validation phase happens first even before your Script task can execute. If the Excel file, doesn't exist then the package validation phase will fail. Setting the above property values will delay the validation and you can check if the first exist or not in your script task. If the file doesn't exist, you can abort the package execution.



来源:https://stackoverflow.com/questions/10293401/how-to-prevent-excel-import-in-ssis-package-when-there-is-no-file-to-process

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