SSIS variables not getting set when executed in a SQL job

  • I have a package that loops through a directory and stores all the file names in that directory to a variable in my package called "File". After processing files they are then moved to an archive directory. Very simple. Works fine running locally in BIDS, but as soon as I try to run it in a SQL job, the variable is not getting set. I know this because it is just grabbing the default excel file path and not the path i am trying to set with my variable "File"

    For Each fileName As String In Directory.GetFiles(path)

    Dts.Variables("File").Value = fileName.ToString()

    Next

    EcelFilePath = @[User::File]

    Again, it works fine locally. Ive tried using proxy account. Banging my head against the wall for 2 days on this. PLEASE HELP!!

  • My first thought is that it is a file system access issue for the SQL Agent. But you say you tried a proxy. Was the proxy set up with your credentials, where you are sure of file system access? What error are you getting in the SQL Agent when it fails?

  • I used my account for proxy. I am sure I can access files in that directory.

    The job does not fail so there is no error. It does not fail because it thinks there are no files to process, sense the variable never gets set.

    Just playing with some tests, I created a send mail task that simply sends some variables that get set in the loop(File name,ext). it returns blank in the email when run in SQL job, but when run in BIDS, the email returns valid variables that where set

  • I'd suggest checking the security logs on the server where the files are located if possible. There's got to be a message somewhere even though the Agent and package didn't throw an explicit error.

    Also, here's a link with some in-depth troubleshooting tips:

    I had a package once where I experienced this problem and tried using my account (which has Domain Admin rights) for the proxy but still didn't work until we created a specific account for the proxy with rights to the folders we needed.

    ____________
    Just my $0.02 from over here in the cheap seats of the peanut gallery - please adjust for inflation and/or your local currency.

Viewing 4 posts - 1 through 3 (of 3 total)

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