Link to home
Start Free TrialLog in
Avatar of Martin Griffiths
Martin Griffiths

asked on

File System Task in a SSIS Package behaves differently when run as SQL Agent job as when run in BIDS/SSDT in SSIS 2012

I have an ssis package that runs a file system task to copy all files from one folder on one server to another. It loops through the files using a for each loop container. I assign values via variables in this. It runs fine in BIDS/SSDT, but when I run it as a sql agent job on my production server it comes up with the following error and I can't fathom why. Any one got any ideas please?

Executed as user: xxx. Microsoft (R) SQL Server Execute Package Utility  Version 11.0.5058.0 for 32-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  18:22:40  Error: 2014-09-24 18:25:02.61     Code: 0xC0014054     Source: Inform of error      Description: Failed to lock variable "" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".  End Error  Error: 2014-09-24 18:25:02.61     Code: 0xC002F304     Source: Inform of error Send Mail Task     Description: An error occurred with the following error message: "Failed to lock variable "" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".  System.Runtime.InteropServices.COMException: Failed to lock variable "" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".".  End Error  Error: 2014-09-24 18:25:02.64     Code: 0x00000006     Source: Check for Missing Files      Description: The script returned a failure result.  End Error  DTExec: The package execution returned DTSER_SUCCESS (0).  Started:  18:22:40  Finished: 18:25:04  Elapsed:  144.031 seconds.  The package executed successfully.  The step succeeded.

Open in new window

Avatar of Jim Horn
Jim Horn
Flag of United States of America image

<potentially stupid question>
Are you using a fully-qualified path, such as \\server\share\folder\file.txt, or a mapped letter such as F:\folder\file.txt?
If letter, then the server has to have the same letter mapping as on your dev box.
Avatar of Martin Griffiths
Martin Griffiths

ASKER

Yes, I am using fully-qualified path here unfortunately so not that easy a fix sorry.
Hi,

I think you have used variables in SSIS package for which you have applied values while calling them as a Job.

You need to create environment and assign values to the variables..
But I've created many variables and the others seem to be working fine.
I've requested that this question be closed as follows:

Accepted answer: 0 points for Grffster's comment #a40343614

for the following reason:

Found the issue. My event handler didn't have a variable set.
Re-opening the question to allow the author to post a valid solution or request the question be deleted.
ASKER CERTIFIED SOLUTION
Avatar of Martin Griffiths
Martin Griffiths

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial