title: SQL LIKE Statement on a DateTime Type
body: <p>How do you perform a <code>LIKE</code> statement on a column of <code>DateTime</code> datatype in SQL Server?</p>
  
  <p>If I run the following SQL it returns me all the dates with 2009 in.</p>
  
  <pre><code>SELECT * FROM MyTable where CheckDate LIKE '%2009%'
  </code></pre>
  
  <p>However, if I want all the Oct, Nov &amp; Dec dates I'd expect to be able to do the following:</p>
  
  <pre><code>SELECT * FROM MyTable where CheckDate LIKE '%2009-1%'
  </code></pre>
  
  <p>But this returns me nothing!</p>
  
  <p>I'm giving the user a filter option where they type in the date string and as they type I filter the data. So if they type '20', I'd like to return all the dates with '20' within the date (so this could be all 2012 dates or a date value like 06/20/1999)</p>
  
  <p>Can anybody help?</p>
  
  <p>I'm using SQL Server 2008.</p>
  
  <p>Thanks in advance. </p>