INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

SSIS Package Variable

SSIS Package Variable

(OP)
I am new to creating ssis packages but I have one that I created via SQL management studio while importing data. What I would like to do is be able to pass the file name to the package and have it import that file instead of the way I have it now which is a specific file name. I am using SQL 2005 if that matters. Can someone explain how that gets done? preferably a way in which I can schedule it as a job.

Thanks.

RE: SSIS Package Variable

You probably don't need to know this at this late date, but I would use a foreach loop container.

First, create a variable to hold the name of the file for subsequent steps in the package. Create and edit the foreach loop container and put your filename wildcard specification (*.txt, or ??????.csv, or INCOMING*.*, or whatever your requirements) for the collection. Have it assign the filename to the variable you have created, and all other tasks within the container can then use that variable to determine which file is being worked on.

The next iteration of the foreach loop will assign the next filename, and will stop execution where there are no more files selected. Note that you cannot specify the order in which these files are picked up; my experience is that they are retrieved in a date/time modified order, but there are techniques where you can create a sorted list of files which a web search should reveal to you readily.

Hope this helps.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close