title: Input to determine how many datasets to pull from
body: <p>Hopefully this will make sense:</p>
  
  <p>Basically I want the user to input a variable at the start to determine how many datasets they want to compare:</p>
  
  <pre><code>DECLARE @NumberOfRuns INT
  SET @NumberOfRuns = (1,2,3.. normally just 2)
  </code></pre>
  
  <p>After this I will have a query on multiple datasets:</p>
  
  <pre><code>SELECT*
  FROM (Dataset 1)
  UNION ALL
  SELECT*
  FROM (Dataset 2)
  </code></pre>
  
  <p>Is there a way that if the input for <code>@NumberOfRuns = 1</code> it only runs the first part, and if the input was 2 it would run both?</p>