title: Query with variables
body: <p>Is it possible to set/read variables from within the query?</p>
  
  <p><strong>pseudo code:</strong></p>
  
  <pre><code>SELECT animal_name,
      @tallest_animal = (select top 1 height from animal order by height desc) as tallest,
      @smallest_animal = (select top 1 height from  animal order by height asc) as smallest
  FROM animals
  WHERE height BETWEEN @smallest_animal AND @tallest_animal
  </code></pre>
  
  <p>I know the result can be achieved by making the query different, my question's real use is too difficult to explain.</p>
  
  <p>It's Microsoft SQL Server in question. :)</p>