title: Convert Datetime string to date in SQL Server
body: <p>I have a datetime data from C# like this</p>
  
  <pre><code>2019-03-20T11:25:32.0342949
  </code></pre>
  
  <p>I tried to convert it to datetime using cast and it triggers error</p>
  
  <pre><code>select cast('2019-03-20T11:25:32.0342949' as date)
  </code></pre>
  
  <blockquote>
    <p>Conversion failed when converting date and/or time from character string.</p>
  </blockquote>
  
  <p>I guess its because of the <code>T</code> in the string.</p>
  
  <p>I tried format also which of course doesn't work because its not identify it as date.</p>
  
  <p>So how can I convert it properly to date. Without some substring methods to extract the date part.</p>