Quantcast
Channel: SQL Server Reporting Services
Viewing all articles
Browse latest Browse all 1418

Stored Procedures with different result columns

$
0
0

Hi,

I have a stored procedure that -among other combinations- can return detailed or summarized rows.

This is just an example, not related to my case. Lets say I have a parameter "@Detail bit"

IF @Detail = 1

  SELECT User, Hours, Price, Total, Description FROM Hours

ELSE

  SELECT User, SUM(Hours) AS TotHours, SUM(Total) AS TotalAmount FROM Hours

The report designer (client RDLC in my case) doesn't know how to handle the different results (and show a list of fields).

Is there a way to deal with this? I need to build two reports, one detailed and the other summarized, and I don't like the idea of using two stored procedures.

Regardles of RDL, is it good practice to build a SP like that? I'm thinking about compilation issues or performance. I'm really no expert in those matters.

I guess this has been asked before, but I couldn't find an answer using search.

Thanks in advance.


Viewing all articles
Browse latest Browse all 1418

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>