I have an SSIS package which loops through the worksheets of an excel file and loads the data into the SQL table. I've used ADO.NET enumerator to accomplish this. The package works fine when I run it in BIDS. But when try to run the package using the below code I get the error "Description: The GetEnumerator method of the ForEach Enumerator has failed with error 0x80131509 "(null)". This occurs when the ForEach Enumerator cannot enumerate. "
Code:
declare
@cmdvarchar(1000)
declare
@ssispathvarchar(1000)
declare
@srcFileNamevarchar(1000)
set
@ssispath='D:\SSIS Projects\ETLPackage.dtsx'
set
@srcFileName='\\servername\folder\filename.xls'
select
@cmd='dtexec /F "'+@ssispath+'"'
select
@cmd=@cmd+' /SET \Package.Variables[User::SrcFileName].Properties[Value];"'+@srcFileName+'"'
select
@cmd
exec
master..xp_cmdshell@cmd
The folders have all the necessary permissions and both BIDS and SSMS are working under the same account. Please help ASAP as the code needs to be delivered by 11/19. Thanks!!