Conversion of String to Teradata Timestamp Format

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
saur_classic
Participant
Posts: 9
Joined: Tue Aug 01, 2006 9:43 pm

Conversion of String to Teradata Timestamp Format

Post by saur_classic »

Hi,

I am facing problem in Converting String to Timestamp.

The Job inserts into Teradata table which has a Date Column as
Cre_Dt TIMESTAMP(0) FORMAT 'YYYY-MM-DD HH:MI:SS'
and the Source file sends the Data in Format 'Mon Jan 08 00:00:00 EST 2007'.

In the transformer just before insertion into the table i need to convert it into the Format 'YYYY-MM-DD HH:MI:SS'

Linkname.Sourcecolumn[25,4]:Linkname.Sourcecolumn[5,15]
gives me '2007:Jan 08 00:00:00'

how to solve this problem?

Please help me
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

Using the Concatenation operator, you can get this close to your objective.

Code: Select all

 Linkname.Sourcecolumn[25,4]:'-':Linkname.Sourcecolumn[5,3]:'-':Linkname.Sourcecolumn[9,2]:' ':Linkname.Sourcecolumn[12,8]
will yield you

Code: Select all

Result = 2007-Jan-08 00:00:00
for

Code: Select all

Mon Jan 08 00:00:00 EST 2007
Since you are using EE/PX, you may need to build a C++ routine to convert the alphabetic month(Jan, Feb......) into numeric to achieve your objective.

Whale.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Post Reply