SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Run Multiple SQL Queries


Run Multiple SQL Queries

Author
Message
engg.pankaj
engg.pankaj
SSC Rookie
SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)

Group: General Forum Members
Points: 48 Visits: 20
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
Ray M
Ray M
SSCertifiable
SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)

Group: General Forum Members
Points: 5119 Visits: 1076
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.
Koen Verbeeck
Koen Verbeeck
SSC Guru
SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)

Group: General Forum Members
Points: 62858 Visits: 13298
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.


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
engg.pankaj
engg.pankaj
SSC Rookie
SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)

Group: General Forum Members
Points: 48 Visits: 20
Thank you so much for the suggestions Smile

I was able to complete the task.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search