I'm trying to convert a numeric column with the following defined format: DDMMYYYY
to a datetime in a mssql database.
What I tried is to do this with a "derive column".
My idea was to get the year, month and day part as strings, concatenate them and convert them to a DT_DBTIMESTAMP with the following code:
(DT_DBTIMESTAMP)(SUBSTRING((DT_WSTR,8)[field],5,4) + "-" + SUBSTRING((DT_WSTR,8)[field],3,2) + "-" + SUBSTRING((DT_WSTR,8)[field],1,2))
I also tried to do it with DT_DBDATE but it didn't work either.
The column of my table looks like this: [GebDat] datetime
Do you have any idea how I can achieve this result? Or maybe give me a hint, what I was doing wrong in the above approach?
Thanks in advance
[Derive Columns Births [397]] Error: An error occurred while attempting to perform a type cast.The cast-error happens when casting to (DT_DBTIMESTAMP) so the cast of the field to DT_WSTR works... And yes, the database expects a date to be YYYY-MM-DDDT_DBDATE? At a guess, you've got some values that cannot be converted correctly to a date.