I cannot easily test this but consider using toDate on the base column to get the date portion and then toTimestamp on the base column to get the timestamp. You shouldn't need to parse the string yourself.
Extracting Time from Timestamp in ADF
Hi
In my source table in SQLDB I have a field, PREANC_DTS datetime2(7)
Example : 2022-03-16 11:56:12.0000000
I want to split the datetime field in a date and time field: PREANC_DT (datatype date) and PREANC_TM (datatype time(7)).
In ADF expression builder this works for PREANC_DT:
iif(isNull(ROK_SLBD_PREANC_DTS),toDate('0001-01-01'),toDate(toString(ROK_SLBD_PREANC_DTS, 'yyyy-MM-dd')))
For PREANC_TM I can get it working , although I tried many things. As you can see I het the time portion, but the output field PREANC_TM becomes a String.
Throughout the data flow the fields keep the right time value, but in the end, in the sink, all those fields become NULL. The pipeline fails and says: PREANC_TM can't be NULL.
I think it happens because the Sink expects a time(7) field and not a string. How to solve and why is there not just a simple toTime function or whatever? :(
Hope someone can help. Thnx a lot
Ron