title: SQL: Can I negate a condition in a where clause?
body: <p>I want to check if a boolean is true, then decide in the WHERE clause what condition to use.</p>
  
  <p>Say the boolean variable is @checkbool:</p>
  
  <pre><code>SELECT *
  FROM TableA A
  WHERE
      --if @checkbool is true, run this
      A.Id = 123
  
      --if @checkbool is false, run this
      A.Id &lt;&gt; 123
  </code></pre>
  
  <p>Is there a way to negate a condition? Like in C++ you can do if !(condition).</p>
  
  <p>If not, what is the best way to solve this problem?</p>
  
  <p>Thank you!</p>