问题
I'm currently working on a requirement to get data from sql server into Excel destination. I used the exact method from this link " https://sqljunkieshare.com/2012/02/28/how-to-create-and-map-excel-destination-dynamically-in-ssis/ " Except the Dynamical excel sheet name (Doesn't work, so removed the dynamical sheet naming and using a static name for all excel workbook)
Condition is : To get a set of distinct ID's from a view and should create an excel sheet for each ID and load the data from the same view with the filter of respective ID from the result Set.
The package worked fine when executed from Visual Studio designer. But i'm facing an error on Excel connection when executing this package from SQL Server job.
Here is the error message :
OnError 1 - Create Excel Sheet:Error:Failed to acquire connection "ExcelDestination". Connection may not be configured correctly or you may not have the right permissions on this connection.
OnError 2 - GenerateExcel:Error: SSIS Error Code DTS_E_OLEDBERROR. An OLEDB error has occured. Error Code : 0x80004005. An OLE DB record is available. Source:"Microsoft Access Database Engine." Hresult: 0x80004005 Description:"C:\Excel\ID_100.xlsx' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.".
on above GenerateExcel - package name ExcelDestination - Excel connection manager name ID_100 - first Excel workbook name (100 is the first ID).
I tried changing the DelayValidation property to True on everything, since the File path is on my local drive i don't think drive permission is an issue.
来源:https://stackoverflow.com/questions/41134496/ssis-package-with-dynamically-creating-excel-destination-is-not-working-from-sql