on 10-24-2019 3:24 PM
HI,
I am getting TEXT file where one of the columns is a date field in the format yyyymmdd .
Need to load this data into HANA DB on SCP.
please advise how to convert this to the format yyyy-mm-dd.
I tried the substring function , but am getting an error on using || for concatenat.. the conversion functions are insufficient for this kind of a conversion.
Appreicate your help.
Thanks
Sudarshan
Hi Sudarshan,
You have not mentioned the target field datatype (date or varchar).
If the target field datatype is 'date', then 'date to date' transformation is straightforward. So, I will take the case that your target field datatype is 'varchar'.
I have tried converting a 'date' datatype (format YYYYMMDD) to 'varchar' datatype (format YYYY-MM-DD) in the following two ways and both worked:
(i) to_char(Source.Field_TypeDate,'YYYY-MM-DD')
(ii) date_part(Source.Field_TypeDate,'YY') || '-' || date_part(Source.Field_TypeDate,'MM') || '-' || date_part(Source.Field_TypeDate,'DD')
Please see if this helps to you and let me know.
Thanks.
Regards
Bhanu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sudarshan,
you can use to_date. in you case, format should be yyyymmdd.
map the value to a date field.
to_date(<input_string>,'<format>')
with regards,
Nazeer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
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.