SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSIS variables not getting set when executed in a SQL job


SSIS variables not getting set when executed in a SQL job

Author
Message
nahjipeel
nahjipeel
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
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!!
Daniel Bowlin
Daniel Bowlin
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4090 Visits: 2629
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?
nahjipeel
nahjipeel
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
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
lshanahan
lshanahan
SSChasing Mays
SSChasing Mays (622 reputation)SSChasing Mays (622 reputation)SSChasing Mays (622 reputation)SSChasing Mays (622 reputation)SSChasing Mays (622 reputation)SSChasing Mays (622 reputation)SSChasing Mays (622 reputation)SSChasing Mays (622 reputation)

Group: General Forum Members
Points: 622 Visits: 436
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search