title: Extract Date from a string using Derived Column in SSIS
body: <p>I have a column called FileName and I wanted extract the date from the column as a Date column using Derived Column in SSIS. The FileName Data type is nvarchar(260)</p>
  
  <p>FileName </p>
  
  <blockquote>
    <p>M:\Mapping\Workforce_Planning\ABC\ABClrmp.full.2016-01-07.csv</p>
  </blockquote>
  
  <p><strong>Desired Result</strong></p>
  
  <pre><code>2016-01-07
  </code></pre>
  
  <p>I have been using SQL task but I prefer to use Derived Column.</p>
  
  <pre><code>Update [dbo].[GET]
  SET [Date] = CONVERT(date, REPLACE(SUBSTRING([FileName], LEN([FileName])-CHARINDEX('\',REVERSE([FileName]),0)+2, LEN([FileName])-(LEN([FileName])- CHARINDEX('\',REVERSE([FileName]),0))),'.csv',''), 121)
  </code></pre>