SSRS 2008 - Can I change the dataset programmatically?
Hi there, I have a report that is working nicely however, a lot of business rules (parameters, etc) need to be set before I call the report. I have come to realize that I will most likely have to create my own parameter section to accomplish what
I need as the pre-built one is too limiting.
My question is, the query will change quite a bit based on the user selections and I want to be able to pass the actual SQL Statement to the report to be rendered based on what the user selected .
Is this possible other than opening, reading and manipulating the actual .rdl?
Thanks much.
JenJen Campion
November 12th, 2010 12:55pm
You can write you store procedure in such way that returns the data you need depending in a parameter, the important thing is that you report need to use the same columns and the store procedures and queries need to do it too
You probably can use something like this
create procedure DifferentResultSet
(
@SelectResultSet int
)
as
if @SelectResultSet=1
BEGIN
exec mystoreprocedure1
END
ELSE if @SelectResultSet=2
BEGIN
select col1,col2 from mytable
END
and use that store procedure as your dataset
Free Windows Admin Tool Kit Click here and download it now
November 12th, 2010 1:35pm