Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Populate tables in report with several Select

Author  Topic 

Ciupaz
Posting Yak Master

232 Posts

Posted - 2013-07-04 : 08:26:18
Hello all,
I have to create a report that has several tables (or matrix, is the same).
Now I've created a stored procedure that has several SELECT statement inside it.
Something like:

EXEC dbo.MyProc @Year = 2013 @Month = 6


Field1 - Field2 - Field3
.....
.....
.....


Field10 - Field11 - Field12 - Field13
....
....
....


Field20 - Field21
....
....



Now is it possible to populate each table of my report with the corresponding
Select statement from my stored?


Luigi

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-04 : 08:54:33
Nope. Reports can capture only first resultset from procedure
so for your need you need to have multiple procedure
or add a optional parameter based on which you return each resultset and you need to pass corresponding value from report in each case to get required resultset

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

Ciupaz
Posting Yak Master

232 Posts

Posted - 2013-07-04 : 09:21:28
So I have to get an unique resultset from my stored?
And for the fields that belongs only one Select, how can I make this?

L
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-04 : 12:29:16
quote:
Originally posted by Ciupaz

So I have to get an unique resultset from my stored?
And for the fields that belongs only one Select, how can I make this?

L


As suggested either you need to separate procs for each resultset or you need to have procedure with if conditions and returning various resulsets in each case. You need to make sure the resultset has same number of columns in each case.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

Ciupaz
Posting Yak Master

232 Posts

Posted - 2013-07-05 : 03:22:04
Ok, I'll try in this way. Thanks a lot Visakh.

Luigi
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-05 : 03:36:47
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -