title: Variable as top value
body: <p><strong>ORIGINAL QUESTION:</strong></p>
  
  <pre><code>declare @num as int set @num = 5
  
  select top @num col1, col2 from table1
  </code></pre>
  
  <p>The above does not work.  It does not like @num being used that way.  What needs to be done so I can have a variable value next to the top command?</p>
  
  <p>It gives the error:</p>
  
  <blockquote>
    <p>Incorrect syntax near '@num'</p>
  </blockquote>