title: Greater than in SQL CASE statement
body: <p>I'm having a hard time figuring out a greater than in a SQL statement.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>select one, two three from orders
  where case when @orderid &gt; 0 then orders.orderid = @orderid end
  </code></pre>
  
  <hr>
  
  <p>@orderid is parameter passed to the stored procedure. The idea is that if a valid (> 0) orderid is passed, then use that as the filter in the where clause, otherwise don't use it all.</p>