Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 124
  • Last Modified:

Reporting services Sql server 2008 from stored procedures

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
tonzur40
Asked:
tonzur40
1 Solution
 
Nakul VachhrajaniTechnical Architect, Capgemini IndiaCommented:
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
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
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
 
ZberteocCommented:
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
 
ValentinoVBI ConsultantCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now