on 08-08-2017 4:14 PM
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.
Regards
Arun Sasi
Cast to varhcar(14) for Date with Timestamp
to_date(CAST(DATETIME,'VARCHAR(14)'),'YYYYMMDDHH24MISS')
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
to_date(CAST(DATETIME_SUBSECONDS,'VARCHAR(22)'),'YYYYMMDDHH24MISS.FF')
Output:
2017.07.24 00:13:47.420000000
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.