Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SSIS variables not getting set when executed in a SQL job Expand / Collapse
Author
Message
Posted Tuesday, June 4, 2013 7:37 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, August 16, 2013 3:56 PM
Points: 2, Visits: 16
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!!
Post #1459771
Posted Wednesday, June 5, 2013 11:51 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 2:36 PM
Points: 2,818, Visits: 2,565
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?
Post #1460358
Posted Wednesday, June 5, 2013 1:09 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, August 16, 2013 3:56 PM
Points: 2, Visits: 16
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
Post #1460400
Posted Thursday, June 6, 2013 7:54 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Yesterday @ 10:33 AM
Points: 140, Visits: 260
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:

[url=http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/ssis-runs-in-bids-but-not-with-sql-agent][/url]

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.
Post #1460704
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse