Must declare Scalar variable - error from parameter
<p>I have a dataset query as below:</p>

<pre><code>SELECT col1, col2
FROM Table
WHERE @DatabaseGrowth = 'DatabaseGrowthByLast7Days'

UNION ALL

SELECT col3, col4
FROM Table
WHERE @DatabaseGrowth = 'DatabaseGrowthByLast4Weeks'
</code></pre>

<p>and have a parameter named <code>DatabaseGrowth</code>. While running the report, if I select <code>DatabaseGrowthByLast7Days</code>, it should return <code>7Days</code>. But, it is showing error </p>

<blockquote>
  <p>Must declare Scalar variable "@DatabaseGrowth"</p>
</blockquote>

<p>What is wrong with my dataset code?
The above code is sample code of my actual code.</p>

<p>Edited the code above.</p>