title: "CASE" statement within "WHERE" clause in SQL Server 2012
body: <p>i have a select statement like this</p>
  
  <pre><code>select x, y , z from table a
  where CAST( CAST(DATEColumn AS VARCHAR) AS DATE) between  
      case when a.columnx = '1900-01-01' then CAST( CAST(DATEColumn AS VARCHAR) AS DATE) else c.columnx end
      and cast( c.CustomerShipToRecTrmDt as date)
  </code></pre>
  
  <p>why does this case statement does not work
  whereas the case statement works if i hardcode the dates?</p>