Foreach loop File Not Found in SQL Server 2014, but found in Visual Studio 2012

  • I have an SSIS package which includes a foreach loop to find a file and then archive it to a different folder once other steps are completed.

    When I execute the package in Visual Studio 2012 Shell, the file is found and is eventually archived. However, I want this to be part of a job in SQL Server Management Studio 2014. So I execute the package there, and it succeeds, but the file was not found...thus it is still in the same source folder.

    I'm not sure if there is something I should look for in the connection managers/parameters within the SSMS package configuration screen, or if there is a disconnect between each when it comes to loops (sort of like 32-bit versus 64-bit runtime, I think).

    So question is...why would this happen?

  • cvoss85 (5/26/2016)


    I have an SSIS package which includes a foreach loop to find a file and then archive it to a different folder once other steps are completed.

    When I execute the package in Visual Studio 2012 Shell, the file is found and is eventually archived. However, I want this to be part of a job in SQL Server Management Studio 2014. So I execute the package there, and it succeeds, but the file was not found...thus it is still in the same source folder.

    I'm not sure if there is something I should look for in the connection managers/parameters within the SSMS package configuration screen, or if there is a disconnect between each when it comes to loops (sort of like 32-bit versus 64-bit runtime, I think).

    So question is...why would this happen?

    Quick thought, this could be a permission issue, make certain that the credentials the package is running under has the right permissions to both the source and destination folders.

    😎

  • I changed the Creator Name for the package to an account which I figured had universal permissions, but to no avail. I can check the credentials with the DBA, if that's what you're moving toward.

    Here is the exact message for clarification:

    The For Each File enumerator is empty. The For Each File enumerator did not find any files that matched the file pattern, or the specified directory was empty.

  • Not the creator name, the account the job is running under. If I remember correctly, by default, this is a SQL account which HAS NO ACCESS TO NETWORK DRIVES. You need to set it up so that the jobs are run under a windows account, so that it can be set up with permissions to access network drives.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • When you refer to the jobs running under a Windows account, do you mean the owner? Might be a naive question, but I wanted to be clear.

  • Setting Up Your SQL Server Agent Correctly.[/url] Especially pay attention to the section What service account to use.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply