title: "Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query." error
body: <p>When I try to execute the following query using Hibernate, I am facing the following error:</p>
  
  <blockquote>
    <p>Implicit conversion from data type varchar to varbinary is not
    allowed. Use the CONVERT function to run this query.</p>
  </blockquote>
  
  <pre><code>String sql = "select distinct t.titleNo  from Ties t ,Titles se,TieType TT ,Net NTT "  
                          +" where t.seriesNo  = se.titleNo and t.titleType=TT.titleType and TT.titleTypeNo = NTT.titleTypeNo  "
                          +" and  ((((t.titleName LIKE '%'+:titleName+'%')  OR (:titleName LIKE '%'+ t.titleName+'%')) AND (ISNULL(TT.titleBaseType,'') ='')  "
                          +" And Isnull(:titleBaseType,'') &lt;&gt; 'N')  "     
                          +"   OR (((t.titleName LIKE :titleName)  OR (:titleName LIKE t.titleName)) AND (ISNULL(TT.titleBaseType,'') ='N')))   "
                          +"   AND (IsNull(se.titleName,'%') like CASE WHEN (:seriesNo&gt;0) THEN  (SUBSTRING(LTRIM(:seriesName),1,6)+'%') ELSE '%' END)";
  
                  Query qry = session.createSQLQuery(sql);
                  qry.setParameter("titleName", titleName); //String
                  qry.setParameter("seriesNo", seriesNo); //Integer
                  qry.setParameter("titleBaseType", titleBaseType); //String
                  qry.setParameter("seriesName", seriesName); //String
  qry.list();
  </code></pre>
  
  <p>How can I avoid this error?</p>