title: SQL Server boolean operators
body: <p>I know that SQL Server does not have boolean data type and your best option is to use BIT data type.</p>
  
  <p>My question is to what boolean expressions evaluate. For example if I have the statement</p>
  
  <pre><code>expr1 AND expr2
  </code></pre>
  
  <p>and if expr1 is true and expr2 is false, do they internally evaluate to BITs with values 1 and 0? And then the AND operator checks for BITs?</p>
  
  <p>I think this is not the case because then the following should work:</p>
  
  <pre><code>select 1 where 1 and 0
  </code></pre>
  
  <p>So does sql server internally have a boolean data type?</p>
  
  <p>The following work</p>
  
  <pre><code>select 1 where 1 = 0
  select 1 where 1 = 0 and 0 = 0
  </code></pre>
  
  <p>but this</p>
  
  <pre><code>select 1 where 1 and 0
  </code></pre>
  
  <p>reports</p>
  
  <p>Msg 4145, Level 15, State 1, Line 1
  An expression of non-boolean type specified in a context where a condition is expected, near 'and'.</p>
  
  <p>which means that internally sql server handles the expressions as booleans, but why don't have access to that data type.</p>