Solved

Reporting services Sql server 2008 from stored procedures

Posted on 2015-02-05
4
91 Views
Last Modified: 2015-02-11
I want to use a stored procedure with multiple select statements  to return only one data
set  at the end For example my procedure has a (fictitious example)

Select  * into # temp1 from sales where products = 1
Select  * into #temp 2 from sales details where customers_name  = 'Juan'
Select * from  #temp1 inner join #temp2 on date_sale = last_purchase

So at the end I want my dataset return to my ssrs project to be the last select statement .
0
Comment
Question by:tonzur40
4 Comments
 
LVL 11

Accepted Solution

by:
Nakul Vachhrajani earned 500 total points
Comment Utility
Maybe I am not understanding it correctly, but because the 1st two statements are SELECT...INTO, they won't generate any result sets. Only the 3rd will generate a result set. What's the exact issue that you are facing?
0
 
LVL 45

Expert Comment

by:Vitor Montalvão
Comment Utility
I'm with Nakul. The first 2 statements only insert and not returning rows. The 3rd one will return the rows for your report.
0
 
LVL 26

Expert Comment

by:Zberteoc
Comment Utility
Your example will work perfectly fine. You prepare some intermediate results in #temp1 and #temp2 temp tables and in the end you will use them to join to return the final result set you need. I don't see any problem with that, the stored procedure can be used in any context, including SSRS.
0
 
LVL 37

Expert Comment

by:ValentinoV
Comment Utility
Have a read through following article to get a better understanding of how SPs work in combination with SSRS:
Reporting On Data From Stored Procedures (part 1)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Written by Valentino Vranken. A while ago I wrote an article called Chart Optimization Tips (http://www.experts-exchange.com/articles/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Chart-Optimization-Tips.html).  This article explained how …
Introduction: This article is aimed at report developers who are used to developing reports using relational databases and have gotten a first-time assignment to develop reports on OLAP cubes. It demonstrates how to build a report using SQL Ser…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now