By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,856 Members | 2,163 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,856 IT Pros & Developers. It's quick & easy.

Visual Studio Reporting Services - MultiValue Parameters

P: 8
Hi, I dunno if this is in the correct catagory, hope so, sorry if it's not.

I'm trying to get to grips with SSRS and having a bit of trouble with multi value parameters.
I'm using the following code in the data section:
Expand|Select|Wrap|Line Numbers
  1. SELECT AccID, AccName, StartDate 
  2. FROM Account 
  3. WHERE AccID= @prmAccID
This works fine with the default settings, the report prompts me for @prmAccID, so I put in an Account ID and it gives me the relevant name and start date to go with that account.

However if I go to the 'Report > Report Parameters' dialog and check the "Multi-Value" checkbox then try and run the report, it still works if I only put one account ID in at the prompt, but if I put 2 account ID's in I get the following error:
An error occured during local report processing.
An error has occured during report processing.
Query execution failed for data set 'DSAccountReport'.
Must declare the scalar variable "@prmAccID".
Surely it should use the following code if i put in AccID 34 and 35
Expand|Select|Wrap|Line Numbers
  1. SELECT AccID, AccName, StartDate 
  2. FROM Account 
  3. WHERE AccID= 34
  4.    OR AccID = 35
Feb 17 '10 #1
Share this Question
Share on Google+
1 Reply


P: 8
Just realised the code I should have been using is:
Expand|Select|Wrap|Line Numbers
  1. SELECT AccID, AccName, StartDate  
  2. FROM Account  
  3. WHERE AccID IN (@prmAccID) 
It doesnt treat it like an OR condition, it treats it like an IN condition and so, with account IDs 34 and 35 for example, it would use the following code:
Expand|Select|Wrap|Line Numbers
  1. SELECT AccID, AccName, StartDate  
  2. FROM Account  
  3. WHERE AccID IN (34,35) 
Feb 17 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.