I need help to convert string value to timestamp(6) based on case when condition as source values are not always in same format, mainly 2 formats available as mentioned in below examples:
START_FNMOMENT_STR is varchar(100) and START_FNMOMENT is TIMESTAMP(6) column
Input:
START_FNMOMENT_STR
4/17/2023 10:57:54
4/16/2023 14:10:13
4/16/2023
4/12/2023
4/16/2023 09:45:00
Expected Output:
START_FNMOMENT
4/17/2023 10:57:54.000000
4/16/2023 14:10:13.000000
4/16/2023 00:00:00.000000
4/12/2023 00:00:00.000000
4/16/2023 09:45:00.000000
I was trying this:
SEL START_FNMOMENT_STR
,CAST(START_FNMOMENT_STR AS TIMESTAMP(0),'YYYY-MM-DD hh24missff6') AS START_FNMOMENT
FROM Table_A ;