SSIS - Help exporting table to excel 2007, table fields may change

  • Hi,

    This may not be possible but I have a table that will be created dynamically within the package. The fields in the table could change. Is there any way to dynamically export this table to excel each time?

    The reason for this is that we are providing users with the ability to specify which fields they want output from the package.

    Biggest problem is that the fields to be exported could change with each run of the package. I cannot see how to do this using normal data flows but perhaps this could be written into a stored procedure or using a script task?

    to give an example, the table will always be called Export_Results

    One run might define the table as having the following fields customer_number; order_no; order_date.

    Another run might define the table as having these fields: customer_number; order_date; order_description; customer_gender; customer_birth_date

    Apologies for the hastiness of this example. I hope this is clear.

    Regards

    R

  • With SSIS out-of-the-box, you cannot do this within a dataflow.

    So you'll need to look at scripting (TSQL or .NET).

    Or you could create a report using SSRS and use that report to export results to an Excel file.

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

  • Thanks Koen, I think I'll have to explore the possibility of exporting using TSQL as I'm not sure we have all the relevant libraries installed on the server for a .NET script to work. Let you guys know how I've got on when it's resolved.

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

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