title: Conversion Failed error in sql
body: <p>I have a problem in my code and I figure it out:</p>
  
  <pre><code>SELECT
     pono,
     convert(varchar,podate,103) as podate,
     Convert(varchar,validity,103) as validity,
     OriginalPOno, Sitename, Vendorname 
  FROM  dbo.tbl_POR_PO_MAIN 
  WHERE originalpono not in (select originalpono from tbl_Despatch_POR_PO_Main)
    AND pono not in (select pono from tbl_Despatch_POR_PO_Main)
    AND status=15
    AND (DATEDIFF(day,getdate(),validity)&lt;=1)
  ORDER BY sitename, validity, originalpono 
  </code></pre>
  
  <p>This gives me a following error:</p>
  
  <blockquote>
    <p>Conversion failed when converting datetime from character string.</p>
  </blockquote>
  
  <p>How do I solve this problem?</p>