title: The data types date and datetime are incompatible in the add operator
body: <p>I recently created in a SQL Server 2008 dev environment a function that concatenates a date and time like this </p>
  
  <pre><code>select cast('2016-11-09 15:35:00' AS DATE) + CAST('00:00:00' AS DATETIME)
  </code></pre>
  
  <p>In SQL Server 2008 it works well but deployed in SQL Server 2016 it throws an error</p>
  
  <blockquote>
    <p>The data types date and datetime are incompatible in the add operator.</p>
  </blockquote>
  
  <p>But it works well ONLY if queries are placed separately</p>
  
  <pre><code>select cast('2016-11-09 15:35:00' AS DATE)
  select CAST('00:00:00' AS DATETIME)
  </code></pre>
  
  <p>So, how can I fix this. I found articles where people say that there is an incompatibility with <code>TIME</code> data type, but I am not using it. In fact, my concatenation is like this</p>
  
  <pre><code> WHERE 
       CREATIONDATE BETWEEN CAST(@CurrentDate AS DATE) + CAST('00:00:00' AS DATETIME) AND CAST(@CurrentDate AS DATE) + CAST('23:59:59' AS DATETIME)
  </code></pre>
  
  <p>where <code>@CurrentDate</code> is a <code>DateTime</code> variable and passed to my function as '2016-11-09 15:35:00'</p>
  
  <p>I cannot modify the configuration of the SQL Server 2016 box. How can I fix my code?</p>
  
  <p>Thanks</p>