title: How to convert string to Date in T-SQL?
body: <p>I have defined my update query as follows to update a <strong>Date</strong> column.</p>
  
  <pre><code>declare @fromDate date;
  set @fromDate = '2019-04-31'
  
  update [dbo].[sites] 
    set [FromDate]= @fromDate 
  where siteid=2832
  </code></pre>
  
  <p>Above gives following error:</p>
  
  <blockquote>
    <p>Conversion failed when converting date and/or time from character 
        string.</p>
  </blockquote>
  
  <p>What Im doing wrong here?</p>