title: SSIS Date to String Conversion Error
body: <p>I'm pretty new to SSIS and I'm running into an issue where I'm using a sql statement in an OLE DB Source step to pull my data and this data contains 5 DATETIME fields that need to be converted and all of the data is going into a flat file. </p>
  
  <p>I'm doing the conversions in sql like so:</p>
  
  <p><code>REPLACE(CONVERT(VARCHAR(10), birthdate, 101), '/', '') AS 'Date of Birth (MMDDYYYY)</code> </p>
  
  <p>In the SSIS Flat File Connection Manager my DataType is string [DT_STR] and my OutputColumnWidth is 8. This is working in SSIS without truncation as the above conversion creates an 8 character varchar. If I try converting to a varchar(8) it truncates the data in sql server management studio. </p>
  
  <p>My problem is that my next conversion attempt is failing. Here's the sql code:</p>
  
  <pre><code>REPLACE(CONVERT(VARCHAR(10), exp_date, 103), '/', '') AS 'Expiration Date
  </code></pre>
  
  <p>I get the following error: "The value could not be converted because of a potential loss of data" even though everything has been reproduced with the same settings. This conversion converts the date to a '<code>DDMMYYYY</code>' format.</p>
  
  <p>I know from researching that this is a data conversion error but I have no idea how to get around it especially with the first conversion working correctly. </p>
  
  <p>The interesting thing is that when I redirect the rows on error to a different flat file the dates get pulled and converted with no problem at all. </p>
  
  <p>I'm at a loss here and would appreciate any help from the group. </p>