title: SQL Server 2005 to 2012 com.microsoft.sqlserver.jdbc.SQLServerException: Implicit conversion from data type varbinary to datetime2 is not allowed
body: <p>We are migrating from SQL Server 2005 to 2012. One of the functionality is failing with this error </p>
  
  <blockquote>
    <p>com.microsoft.sqlserver.jdbc.SQLServerException: Implicit conversion from data type varbinary to datetime2 is not allowed. Use the CONVERT function to run this query.</p>
  </blockquote>
  
  <p>We use <code>SQLJDBC driver 3.0</code> to communicate with SQL Server 2012. I see this issue is happening when we try to insert NULL value into a <code>DATETIME</code> column (nullable). Same however works in 2005. Any help with this issue is appreciated.</p>
  
  <p>It's a simple <code>INSERT</code> statement that fails from Java to SQL server 2012 using MyBatis ORM:</p>
  
  <pre><code>Insert into temp_test (date1, name, date2) values ('2010-10-10 00:00:00.0','test',null) 
  </code></pre>
  
  <p>This insert fails when we try from our app (using SQL JDBC driver)... However same code base works without any issue in SQL 2005. </p>