title: ssrs 2008 - Pass a parameter value to a variable in the dataset
body: <p>I have a variable in my dataset that is used to decide which query to run, something like:</p>
  
  <pre><code>DECLARE @Flag char(1);
  
  BEGIN
   IF @Flag = 1
   (
      -- Run query1
   )
   ELSE
   (
     -- Run Query2
   )
  
   END
  </code></pre>
  
  <p>In the report I want have a parameter, either a drop down or checkbox (I'll figure out which), that passes a 1 or 0 to the @Flag variable in the dataset so the correct query will run.</p>
  
  <p>I have tried adding a parameter to the report, set to boolean, with the name @Flag, hoping it will make the connection, but I am getting an error saying @Flag needs to be declared.  I have tried some other things but tracking it with SQL profiler shows no value getting there.  How do I get a value from a parameter to a dataset variable?</p>