timestamp

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
laxmi_etl
Charter Member
Charter Member
Posts: 117
Joined: Thu Sep 28, 2006 9:10 am

timestamp

Post by laxmi_etl »

Hi,

I have a field 'A' coming in from the source as varchar2(16)
The values is 200702231233 actually it's a datefield.
I need to convert it into timestamp with the fallowing format
2007-02-23 12:33:00
basically when I perform conversion I need to concatenate seconds.
I used string to timestamp functions in different ways but none of them are working.

Moreover the values are getting with ************* marks when I use conversion functions.

Any thaughts on this?
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

What is the syntax you are using? Try something like this:

Code: Select all

StringToTimestamp(A[1,4]:'-':A[5,2]:'-':A[7,2]:' ':A[9,2]:':':A[11,2]:"00.000","%yyyy-%mm-%dd %hh:%nn:%ss.3") 
Check for Null values before doing any conversions.
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

or something like

Code: Select all

StringToTimestamp(in.Col,"%yyyy%mm%dd%hh%nn")
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

I guess your target is expecting the timestamp in complete format. you need to concatenate those milliseconds too.
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What is your target database? What is the scale and precision set for this field?
When you load with CurrentTimeStamp() and view data, what is the format you see?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
laxmi_etl
Charter Member
Charter Member
Posts: 117
Joined: Thu Sep 28, 2006 9:10 am

Post by laxmi_etl »

Never mind everything is Ok.
Later we found that there is a problem with the data.

But anyhow thanks for your response.
Post Reply