How to dynamically determine out filename from within SSIS

  • I am fairly new to SSIS and I have what seems a difficult task ahead of me.

    I have a requirement to write multiple files from within one SSIS package. This is made more difficult by the fact the number of files being written each time can vary. The variance is based on a field within the returned query. Sometimes there may be five files and another time there could be twenty. I'm trying to work out a way of processing file by file by closing the old and opening the new based on the data within the query. The filename must also reflect that value that comes from within the query.

    Any suggestions would be most appreciated.

    Please bear in mind that my newness to SSIS stretches to the fact I'm unsure of even how to pass data from a query into a filename.

  • Are the files all of the same format? Are they going to the same destination folder?

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Same folder, same format. What I'm trying to work out thougth idn't so much a worry of the format but the name of the file. I want to be able to write to the first file and when the "key" changes, close file and open new file and repeatedly do this until the entirte resultset from the SQL is exhausted.

    Thank you.

  • [font="Comic Sans MS"]

    You can use forEachLoop container for this. Assign the enumerated value of the field to an user defined SSIS variable - generate the recordset using the query - create file and loop through the enumeration.

    you can have a look here : http://www.sqlis.com/post/Shredding-a-Recordset.aspx

    [/font]

    [font="Comic Sans MS"]--
    Sabya[/font]

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

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