Click here to monitor SSC
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
Forum Newbie
Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: General Forum Members
Points: 8 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
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1491 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
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16455 Visits: 13207
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?

Member of LinkedIn. My blog at SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
engg.pankaj
engg.pankaj
Forum Newbie
Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: General Forum Members
Points: 8 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