4
votes

I am using SSRS 2008 R2. And found situation which seems to me a bug.

I have a shared dataset -

SELECT 'value1' AS Value
UNION
SELECT 'value''2'

I bind this DS to multivalue parameter. When I check only value'2 from multivalue drop down - I see that in SQL Profiler such parameter is passed

@Value=N'value''2' -- Two single quotes

When I check both values in profiler I see

@Value=N'value1,value''''2' -- Four single quotes

My Procedure treats first case correctly.

It seems to me that escape happens twice - first for every value, second for whole string?

Does anyone know the source of such behaviour, Thx in advance!

Here is the same thread on MS

1

1 Answers

6
votes

I experienced a very similar problem - the weirdest part, as you've seen, is that it worked when one parameter was selected but not for multiple parameters.

Anyway, I solved this by passing the parameter to the stored procedure slightly differently - in the Parameters section of the dataset use the following expression:

=Join(Parameters!Value.Value, ",") substituting your parameter name as appropriate.

This effectively will still pass the same comma delimited string of values but for some reason seems to handle the quotes correctly.