user1966849
user1966849

Reputation: 27

TSQL Paramterised Pivot Query SP SSRS

Wonder if anyone has done this before and what solution you came up with?

I have a Stored Proc that basically is a financial aged debtors query. I have added params to it so that you can select the Start Date, Frequency and Period length of the query. e.g. I could pick 12 months back from TODAY or 01/01/2012 or 4 Quarters back or 1 year back depending on the detail of the output I wish to see.

All well and good and when I run it in SQL it is lovely and works beautifully. I have pivoted the data within the SP in different ways depending on the Period param so that the columns show correctly (i.e. Shows the month name column for months, Quarter name for quarters etc etc.) so the pivot is conditional on the input parameter.

As I say in SQL it is a beautiful thing... now how the hell do I display it in SSRS!? :o)

As the PIVOT is conditional I can't see the available fields and I've got to a point where I can't think anymore of a way around it.

Any help appreciated!

Upvotes: 1

Views: 226

Answers (1)

Gil Peretz
Gil Peretz

Reputation: 2419

Assuming I got you right, there is an option to place the entire SP in the Dataset.

In the dataset properties , change the query type to Store Procedure.

Hope it helps for you...

Upvotes: 1

Related Questions