Run Multiple SQL Queries

  • I am new to SSIS so need help with some issues. Creating a task which involves running multiple sql queries and then exporting its result to an excel file. I checked online and found that "Execute SQL task" has the capability of running multiple sql queries but I am not sure how to get its output in an excel file OR how to attach it to a data flow task.

    Please help.

    Thanks

  • Execute sql tasks do not allow you to export data to a file.

    As stated your running multiple queries in your execute sql task.

    You can select your results and store them in a variable with a type of Object.

    and use a script task to export the file, but this is technical.

    Or you can Create a "Staging" Table in your sql server source. Insert all the data you want to export to this staging table, and then you can use that table as the source for your export. This is a common method for exporting data. Very simple, and the staging table serves as a handy resource for you to validate data and perfrom as many transformations on the data in native sql which is usually faster than doing them in SSIS.

    I usually do a simple select from the source database in a dataflow container, and insert the Target data into a staging table in my ETL database, do any masaging I need with sql tasks, and then export the data in a different dataflow container.

  • You can have multiple OLE DB sources in your dataflow. Each of them executes one SQL query. You can append to resultsets to each other using the UNION ALL component if each resultset has the same layout. If they have different layouts you'd need different dataflows for each SQL query.

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

  • Thank you so much for the suggestions 🙂

    I was able to complete the task.

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

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