char to Date

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
vzmz
Participant
Posts: 36
Joined: Sun Nov 23, 2003 12:10 pm
Location: Dallas

char to Date

Post by vzmz »

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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

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,
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply