Export query to two files

  • SSIS rookie here.

    I was tasked to send a daily query result to a text file.

    The comma delimmited file has to be the same name every day (for an Apps import requirement).

    Since it is overwritten daily, I wanted to create an additional archive file in a different directory with a date/time stamp (accomplished that with 'variables').

    I was able to do both files with two different packages and I run them both in my Job Sched on the same Job.

    Just to be clear it is working fine this way.

    But I wanted to learn how to do both files in the same package.

    I created an additional DestinationConnectionFlatFile connection but I couldn't determine how to output to it (output to both).

    I currently just have a Source (Query) and a DestinationFlatFile.

    How could I accomplish this goal?

    Does anyone know of a similar tutorial?

    Thank You

  • Just split the datastream into two datastreams by using the multicast component. That way you'll have two outputs. Connect each of them to the corresponding file.

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

  • Koen Verbeeck (1/26/2012)


    Just split the datastream into two datastreams by using the multicast component. That way you'll have two outputs. Connect each of them to the corresponding file.

    Or maybe you could add a file copy at the end of your package - use a file system task or script task to do this.

    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

  • Phil Parkin (1/26/2012)


    Koen Verbeeck (1/26/2012)


    Just split the datastream into two datastreams by using the multicast component. That way you'll have two outputs. Connect each of them to the corresponding file.

    Or maybe you could add a file copy at the end of your package - use a file system task or script task to do this.

    Hmmm, an even better solution!

    It reduces network traffic and has less memory impact on the server that runs SSIS.

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

  • Great, thank you for the advice.

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

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