Export each result row to it's own .doc file

  • A client would like to pull results from a table and export each row to it's own separate file. I am trying to use SSIS to do this. I have the sql query ready in a data flow task, but I'm not sure how to setup the variables to put each result row into it's own file and then name the file a particular name. The file name will be part of the row result. I am only pulling two fields from a table to get my results. The first field is an ID field which will become the file name. The second field is a data type of text and will go into the .doc file.

    Any help would be appreciated.

    Thanks.

  • You can use a for each loop to loop over the table. In the for each loop, place a data flow task that will write the corresponding row to the file. Use expressions to set the filename of the file in the flat file destination.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • An ExecuteSQL task should be used to assign the table rows to an SSIS package-level variable of type object and a FEL should be used to shred the variable, processing one row at a time ...

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • The Export Column component in the Data Flow worked perfectly for this. No variables needed.

  • Erin-489205 (12/22/2010)


    The Export Column component in the Data Flow worked perfectly for this. No variables needed.

    Hmmm, I have never used the Import/Export columns before. I really should look into those components, so that I can make better suggestions to people 🙂

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 5 posts - 1 through 4 (of 4 total)

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