Passing multiple value through sql query to generate SSRS 208 report
i have 3 parameter in my ssrs reports,but my Third Parameter is MONTH where i have to select multiple Month to see the reports ,example Year parameter i select 2001,Quarter Parameter i select Q1,and in MOnth parameter i need to select 1,2,3(jan.Feb,Marc).but
if i select multiple value then my report does not genetrate giving me an error cannot convert nvarchar to numeric
My stored Proc which i have used to generate report
create procedure time(@yearid numberic,@quarterid numeric,@monthid nvarchar(2500))
select * from TimeTable
where Yearid=@yearid and quarterid= @quarterid and monthid in (@monthid)
i have 4 dataset
1st is the Main query which contain columns coming from above sp
My Year Dataset in SSRS
select year id,Year from TimeTable
My Quarter Dataset in SSRS
select Quarterid,Quarter from TimeTAble where Yearid=@yearid
My MonthDataset in SSRS
select Monthid,MOnth from timetable where Quarterid=@quarterid
mY REPORTS RUN FIINE IF I SELECT SINGLE VALUE FROM ALL THE 3 PARAMETER,BUT IF A SELECT MULTIPLE VALUES FROM MONTH PARAMETER,THEN IT FAILS ..I HAVE ALSO SELECTed MULTIVAULE OPTION IN PARAMETER pARAMETER PROPERTIES OF MONTH PARAMETER,
WHAT SHOULD I DO
I TRIED 1 MORE OPTION ,IN MY MAIN dATASET PROPERTIES IN PARAMETER TAB IN PLACE OF
=Parameters!MONTH.Value
I HAVE USED =join(Parameters!MONTH.Value," ',' ")
........BUT IT DIDNT WORK TO SELECT MULTIPLE VALUE 1,2,3 IN MONTH PARAMETER,and i am using yearid,quarterid and month id in Value field and year,quarter and month respectively in Label field in AVAILABLE VALUE TAB OF REPORTS PARAMETER PROPERTIES
..BUT NOTHING IS WORKING
December 16th, 2010 5:46am
monthid in (@monthid)
This is the part that's causing the problem.
In your sp, you need to parse the comma separated string into a table variable or similar, then join on this to extract the matching rows. There are a few ways of doing this; some involve looping over the string and some involve the xml nodes method.
Free Windows Admin Tool Kit Click here and download it now
December 16th, 2010 7:56am
hi BIGFISHsql
What change should i make in my Sp.if u could help me??
December 16th, 2010 9:23am
Hi,
I think you need to join the parameter values when user selects multiple values from the Report Parameter, under DataSet Properties "Parameter" tab, expression:-
=Join(Parameter-Name, ",")
Please let us know your feedback.
Thanks
KumarKG
Free Windows Admin Tool Kit Click here and download it now
December 16th, 2010 9:44am
Tried this but didn't work for me.
January 27th, 2011 6:46am