• Thanks for the response Tim. This is a new script approach than the one i had in mind but exactly the same concept i was thinking of as follows:

    1) Run existing SQL for Orders/Orderdetails

    2) Script Task

    - Use the Datareader for the SQL

    - Loop Through each row

    - Assign variable storing previous row ID

    - Write the row data to a new file output or a blank line if the ID is different than the variable.

    I am half way completing my version of the script which appears to be working so far but i will try and use yours and post my results.

    Thanks for the code.