title: T SQL How to convert Varchar to Date
body: <p>I'm using MS SQL Server 2016.</p>
  
  <p>I have a field 'MyDate' in table 'MyTable'.  It contains dates in varchar(10) in the format dd/mm/yyyy e.g. 21/01/2020</p>
  
  <p>How do I convert these to SQL Datetime format?</p>
  
  <p>I have tried:</p>
  
  <pre><code>select CONVERT(varchar(10), CAST(MyDate as date), 103) as 'dd/mm/yyyy' from MyTable
  </code></pre>
  
  <p>and</p>
  
  <pre><code>select FORMAT(CONVERT(DATE, MyDate, 21), 'dd/MM/yyyy') FROM MyTable
  </code></pre>
  
  <p>But receive the error:</p>
  
  <pre><code>Conversion failed when converting date and/or time from character string.
  </code></pre>
  
  <p>What am I missing?</p>