Append to a raw file within a foreach loop

  • Hi,

    I want to process several files within a foreach loop. The loop contains a data flow that reads data that has to be appended to a raw file.

    My problem is, that I cannot find a way to ensure an empty raw file (like create it) for the first loop but to append data from all following loops.

    Thank you in advance

    Alexander

  • You could use the following steps

    0. create an empty raw file on the file system where the SSIS package can access it

    then in the SSIS package

    1. use the file system task to copy an empty raw file and then rename the copy - this is handy as you can date stamp the file name

    2. use a script task to set the file connection settings to point to the new file

    3. start your for each loop to write into the raw file

  • In the Raw file properties dialogue set WriteOption to 'append' and ValidateExternalMetaData to false. This should still create the file on the first iteration. I found it to be inconsistent in the past, thus if speed is no issue then a flat file destination is friendlier in this regard.

    ----------------------------------------------------

  • Alexander G. (5/11/2009)


    Hi,

    I want to process several files within a foreach loop. The loop contains a data flow that reads data that has to be appended to a raw file.

    My problem is, that I cannot find a way to ensure an empty raw file (like create it) for the first loop but to append data from all following loops.

    Thank you in advance

    Alexander

    Alexander,

    What is the reason you want to write to raw data file?

    ---
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

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

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