title: select TOP (all)
body: <pre><code>declare @t int
  set @t = 10
  if (o = 'mmm') set @t = -1
  select top(@t) * from table
  </code></pre>
  
  <p>What if I want generally it resulted with 10 rows, but rarely all of them.</p>
  
  <p>I know I can do this through "SET ROWCOUNT". But is there some variable number, like -1, that causing TOP to result all elements.</p>