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.
I'm doing the conversions in sql like so:
REPLACE(CONVERT(VARCHAR(10), birthdate, 101), '/', '') AS 'Date of Birth (MMDDYYYY)
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.
My problem is that my next conversion attempt is failing. Here's the sql code:
REPLACE(CONVERT(VARCHAR(10), exp_date, 103), '/', '') AS 'Expiration Date
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 'DDMMYYYY
' format.
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.
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.
I'm at a loss here and would appreciate any help from the group.