How to loop through SQL Table from SSIS to get file names and export

  • Hello Hel,

    Try verifying if the SQL task is returning an object and if the varible is also declared as an object.

    Pimenta

  • Just to say thanks for ypur post, because it helped me understand how to read from a table into the variables, on a row set, not just one value.

    Bruno Pimenta

  • StevefromOZ ROCKS!

    Beautiful solution, Steve. I struggled for two days trying this on my own, then I found your solution, and in minutes IT WORKED.

    Many thanks,

    --Paul

  • Many thanks saved me a lot of time on that learning curve

  • SteveFromOZ,

    Just stumbled across this 2 years after you wrote it while looking for something else. It happens to have solved a step I was going to tackle next (automatic creation of files) and I wanted to say Thank You! This was awesome and well written.

    --------------------------------------
    When you encounter a problem, if the solution isn't readily evident go back to the start and check your assumptions.
    --------------------------------------
    It’s unpleasantly like being drunk.
    What’s so unpleasant about being drunk?
    You ask a glass of water. -- Douglas Adams

  • This was really helpful, though my requirement was to use different connection string depending on the DataSource value both stored in the table, this helped me in achieving my goal. Thanks a lot !!!

  • Glad it helped!

    It's very confusing sometimes figuring how to loop through and assign dynamic variables in SSIS!

  • Mr. Strate in his 31 days of SSIS has a real life package that performs the functionality that you are rquesting. Here is alink to the aricle that contains a link at the bottom to download the package. hope this helps.

    http://www.jasonstrate.com/2011/01/31-days-of-ssis-jim-croce-and-the-foreach-file-loop-container-2831/

  • Thanks so much for the info! This seems to be working, but I can't find where the files are going. I've specified where I want them to go in the Flat file destination, but when I look they're not there...

    Thanks!

  • Sounds to me like a permissions issue.

    Check and make sure the user you are logged in as on the SQL server also has permissions to write to the folder you're writing the flat files to.

    Alternatively, change the flat file folder to sit somewhere on the SQL server that you know your user login has permission to, and try running it again.

  • That was the problem.

    Thanks

  • do you have a examples How to loop through SQL Table from SSIS to get file names and export

    all i wanyt is to export all table from a database in a flat file were the output is the table name with .csv

    can anyone help

    in ssis please

  • sullyf50 (9/19/2011)


    do you have a examples How to loop through SQL Table from SSIS to get file names and export

    all i wanyt is to export all table from a database in a flat file were the output is the table name with .csv

    can anyone help

    in ssis please

    You might want to start a new thread to ask this question. This one hasn't been active since February. If you start a new thread, more people will see it.

    --------------------------------------
    When you encounter a problem, if the solution isn't readily evident go back to the start and check your assumptions.
    --------------------------------------
    It’s unpleasantly like being drunk.
    What’s so unpleasant about being drunk?
    You ask a glass of water. -- Douglas Adams

  • i am new to this how do i put a new tread

    all i want is some help in exporting all tables in ssis

  • sullyf50 (9/23/2011)


    i am new to this how do i put a new tread

    all i want is some help in exporting all tables in ssis

    If you click the Forums tab on the left, it will give you a list of all the forum areas. Go to the one at the top and, once in that forum, click "New Topic". Fill out the form and give as much detail as possible.

    As for your problem, I'd suggest you use the wizard and save the package when it is done.

    I'll look for your post there later in the day and see what help I might be able to give once you've posted details.

    --------------------------------------
    When you encounter a problem, if the solution isn't readily evident go back to the start and check your assumptions.
    --------------------------------------
    It’s unpleasantly like being drunk.
    What’s so unpleasant about being drunk?
    You ask a glass of water. -- Douglas Adams

Viewing 15 posts - 16 through 30 (of 31 total)

You must be logged in to reply to this topic. Login to reply