Hi folks
I am trying load a fixed length sequential file into a TERADATA table. I have a field of 8 char length in format of yyyymmdd which is mapped to a date field in teradata. But the data in Teradata after the transformation is not in the same format. Is their any function that i can used and convert it to Date.
Thanks in advance
char to Date
Moderators: chulett, rschirm, roy
I'm assuming that you know the date format your Teradata table is expecting, I don't. How much help do you need?
If you are sure of the validity of the date string coming over, you could simply use the sub-string operator "[]" to hack the string up and piece it back together in the 'right' order. For example, the year portion of your field would be FIELDNAME[1,4].
If you need to check the validity of the date coming in, look at the online help for ICONV, STATUS and OCONV. Iconv would convert the date to an internal format and then Status would let you know if it was able to do so or not. If it was ok, use Oconv to convert it back out in the format required by Teradata.
Hope this helps,
If you are sure of the validity of the date string coming over, you could simply use the sub-string operator "[]" to hack the string up and piece it back together in the 'right' order. For example, the year portion of your field would be FIELDNAME[1,4].
If you need to check the validity of the date coming in, look at the online help for ICONV, STATUS and OCONV. Iconv would convert the date to an internal format and then Status would let you know if it was able to do so or not. If it was ok, use Oconv to convert it back out in the format required by Teradata.
Hope this helps,
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers