title: Change Two digit year to 4 digit year with correct century (not allowed to modify two year cutoff date option)
body: <p>I tried to do a little research on this, but didn't have much luck.</p>
  
  <p>I have a date (MMDDYY format) stored in a <code>varchar</code> field (DateValue) in a table that looks something similar to this:</p>
  
  <h2><strong>TableA</strong></h2>
  
  <h2>--------------------------------------------------------------------------------------------------------</h2>
  
  <pre><code>----------------------                                  
  || ID  |  DateValue ||
    -----  -----------    
  || 1   |  011212    ||
  || 2   |  011549    ||
  || 3   |  070860    ||
  </code></pre>
  
  <h2>--------------------------------------------------------------------------------------------------------</h2>
  
  <p>I am trying to add another column <code>ConvertDateValue</code> to the same table which would be a <code>date</code> field. The values in this column would be converted values from <code>DateValue</code> field in this format (YYYY-MM-DD). Here is what I have tried:</p>
  
  <pre><code>--declare table variable
  declare @tableA table (ID int, DateValue varchar(50))
  
  --insert sample values into table variable
  insert into @tableA VALUES 
  (1,'011212'),
  (2,'011549'),
  (3,'070860')
  
  begin
  select ID,
         DateValue,
         CAST(STUFF(STUFF(DateValue, 3, 0, '-'), 6, 0, '-') as date) as ConvertDateValue 
   from @tableA 
  end
  </code></pre>
  
  <p><strong>Output:</strong></p>
  
  <hr>
  
  <pre><code>|| ID  |  DateValue ||  ConvertedDateValue ||
    -----  -----------    ------------------
  || 1   |  011212    ||   2012-01-12        ||
  || 2   |  011549    ||   2049-01-15        ||
  || 3   |  070860    ||   1960-07-08        ||
  </code></pre>
  
  <p><strong>Expected Output:</strong></p>
  
  <hr>
  
  <pre><code>|| ID  |  DateValue ||  ConvertedDateValue ||
    -----  -----------    ------------------
  || 1   |  011212    ||   2012-01-12        ||
  || 2   |  011549    ||   2049-01-15        ||
  || 3   |  070860    ||   2060-07-08        ||  --Here is the difference 
  </code></pre>
  
  <p>I need to ensure that the <code>ConvertedDateValue</code> is displaying correct century. The above value could also be <code>1960-07-08</code> for some data and not for others. </p>
  
  <blockquote>
    <p>FYI, I am aware of the two year cutoff date option and we have the default
    value set for that i.e. year <code>2049</code>. Unfortunately, I am not allowed to change any of the advanced option settings for various reasons. </p>
  </blockquote>
  
  <p>I am open to feedback and what alternatives are out there? Thanks in advance!</p>