SSIS variable quandary

I have an SSIS package in which I am attempting to import select Excel files into SQL Server based on the date they were run.  The worksheet format of the nightly drop is consistent, with field names and types being uniform.  The date of each run is specified in the file name and worksheet name.  The file name is of the type "ABC_YYYYMMDD.xls", and the worksheet name is "ABC_YYYYMMDD".  

In Visual Studio, I have a variable SetDir, which establishes the directory in which the files are located.  I also have the variable SetDate, which determines the date I want to get in the YYYYMMDD format.  I have set Excel File Path to the followoing expression:

        @[User::SetDir] + "ABC_" +  @[User::SetDate] + ".xls"

Finally, I created a WorksheetName variable that translates to the following expression:

        "ABC_" +  @[User::SetDate] + "$"

I have assigned my worksheet name to a variable (see the screen), but at this point, I run into an error stating "A destination table name has not been provided."  What seems to be happening is that the expression to which WorksheetName translates is not translating properly, but I don't understand why.  I would appreciate some feedback on this.

Sincerely, ~Peter Ferber
SetTableName-ToVariable.bmp
PeterFrbWeb development, Java scripting, Python TrainingAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LCSandman8301Commented:
does this occur when you are debugging? or when it is running in production?

if this is a problem during debugging, more specificallty in the preexecute phase, it is because the variable you are using does not have information in it that matches the file you are providing.
first try to use your test data by hard coding that information in and rerunning it.

0
Jason Yousef, MSSr. BI  DeveloperCommented:
Hi,
Check if that works for you..

http://asqlb.blogspot.com/2011/10/get-excel-sheet-names-in-script-taks.html

Regards,
Jason
0
PeterFrbWeb development, Java scripting, Python TrainingAuthor Commented:
I've done some research into this, and I believe I have an answer, which was partly inspired by huslayer's email link.  The problem seems to be that the variable must be explicitly set with the correct value for the Worksheet Name to resolve correctly, and, frustratingly, the value does not derive itself from the calculated expression.

I think what would work is if I set the variable in another package, call it "Master", using a script task and then run the package, call it "Slave" having first preset the variable value.  The rub, however, is being able to set a variable in "Master" that "Slave" can see.  The scope of variables that I can set appears to be limited to the package in which I'm working, but I want "Slave" to see a variable I've set in "Master".  If I can create a variable in Master that Slave recognizes, I should be able to solve this problem.  Any thoughts on how to do that?

~Peter
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

LCSandman8301Commented:
ok that is actually not bad to do. it is in the package configurations. where you then select from the drop down "parent packagg variable" then you give it the name of the variable in the parent package. the rub is the variable in the child package has to be a global variable, or package level variable so you can set it. then from your parent/master call the child package
0
LCSandman8301Commented:
another way to do this without the parent packages is to have a package level variable and alter the location and table names in variables prior to going into the data transformation component. i ran across an issue where variables are only editted after the completion of a package so if you change a variable inside one component inside of a data component it won't be changed until after that data component is completed.
0
PeterFrbWeb development, Java scripting, Python TrainingAuthor Commented:
You've stated the problem correctly.

I created a parent package variable, but I don't know how to let the Master package view the parent.  I think I've got the necessary pieces, but I don't know how to get them to talk to each other.

~Peter
0
LCSandman8301Commented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PeterFrbWeb development, Java scripting, Python TrainingAuthor Commented:
I finally have it, finally!  What's a bit tricky is that the Parent package has to have a variable with the same name as the "Parent variable" parameter.  Once I groked that, the rest fell right into place.

Thankfully and gratefully, ~Peter Ferber
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.