title: SQL Server 2014 Type DATE is not a defined system type
body: <p>I am using the below query in the stored procedure</p>
  
  <pre><code>SELECT @ICOUNT = COUNT(*)
  FROM MESSAGES
  WHERE CAST(CREATEDDATE AS DATE) &gt;= CAST(@STARTDATE AS DATE) 
      AND CAST(CREATEDDATE AS DATE) &lt;= CAST(@ENDDATE AS DATE);
  </code></pre>
  
  <p>Its working correctly in Sql Server 2008, Where as in Sql Server 2014 I'm facing the below error:</p>
  
  <blockquote>
    <p>Type DATE is not a defined system type.</p>
  </blockquote>