Skip to Content

decimal to datetime conversion

Hi All,

I want to convert decimal values to datetime values. Looks silly but its kind of tricky :)

for e.g

20170723231018 value has decimal(15,0)

20170723231018.1340000 value has decimal(21,7)

I converted the decimal value to varchar and it gets converted but when I try to convert the varchar string to datetime using to_date() it says that it cannot convert the string to date format YYYY.MM.DD

Target Table is HANA and Source is SAP BW table

Any help or hint would be appreciated.


Arun Sasi

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Aug 08, 2017 at 05:42 PM

    Cast to varhcar(14) for Date with Timestamp

    Output will be in datetime column

    2017.07.23 23:10:18.000000000

    Cast to varchar(22) and then convert to datetime for including Date with timestamp with sub seconds


    2017.07.24 00:13:47.420000000

    Add comment
    10|10000 characters needed characters exceeded