I have a CSV file with a {LF} delimiting each row and a date column with the date format as "12/20/2010"
(including quotation marks)
My destination column is a SQL Server 2008 database table of type date (not datetime)
In my Flat File Connection Manager, I have configured the date column to be data type date [DT_DATE]
with TextQualified set to true and the column delimiter as {LF}
(it is the last column on each row). I have the text qualifier set to "
When I try to load this into an OLE Destination I get the following error
[TRN_DORPS [760]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80004005 Description: "Invalid character value for cast specification.". [TRN_DORPS [760]] Error: There was an error with input column ""CYCLE_DATE"" (874) on input "OLE DB Destination Input" (773). The column status returned was: "The value could not be converted because of a potential loss of data.".
If I attach a data viewer, the value in the pipeline is 2010-12-20 00:00:00.0000000
- is this time component what's causing the problem? I try to strip out the time component with (DT_DATE)(DT_DBDATE)[CYCLE_DATE]
but to no avail as it stays the same in the pipeline
I was ultimately able to resolve the solution by setting the column type in the flat file connection to be of type "database date [DT_DBDATE]"
Apparently the differences between these date formats are as follow:
DT_DATE A date structure that consists of year, month, day, and hour.
DT_DBDATE A date structure that consists of year, month, and day.
DT_DBTIMESTAMP A timestamp structure that consists of year, month, hour, minute, second, and fraction
By changing the column type to DT_DBDATE the issue was resolved - I attached a Data Viewer and the CYCLE_DATE value was now simply "12/20/2010" without a time component, which apparently resolved the issue.