title: Sql Server Reporting Services Must Declare the scalar variable @param
body: <p>I have a Sql Server reporting services project. I have a dataset query called Total where I select certain data based on a parameter:</p>
  
  <pre><code>select ...
    from ...
  group by ...
  
  having prop_id = @PropID
  </code></pre>
  
  <p>Now to populate a list of multiple values for this parameter, I have a dataset query called AllProps that selects all possible prop_id's:</p>
  
  <pre><code>select prop_id from proposal
  order by prop_id
  </code></pre>
  
  <p>Now in the Report Data Pane I select the parameter properties from @PropID and fill out the forms as follows:</p>
  
  <pre><code>Under General I have,
     Name: PropID
     Data type: Text
     (I select "Allow multiple values")
  
  Under Available values I have,
     Get values from a query
     Dataset: AllProps
     Value Fields: prop_id
     label field:  prop_id
  
  Under Default Values I have,
     Get values from a query
     Dataset: AllProps
     Valuefield: prop_id
  </code></pre>
  
  <p>When I click the preview tab to see my report I get the following error:</p>
  
  <p>An error occurred during local report processing. An error has occurred during report processing. Query execution failed for dataset 'Total'.</p>
  
  <p>MUST DECLARE THE SCALAR VARIABLE '@PropID'.</p>
  
  <p>Where did I go wrong? What is scalar variable in SSRS and how is it properly used?</p>
  
  <p>Thanks</p>