Concatenate/Convert date and time to 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
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Concatenate/Convert date and time to timestamp

Post by vinaymanchinila »

Hi,
I have 2 source columns
Column1 (Char8)=20060624
Column2(Char6)=174911

I need to write to an oracle table as a timestamp, is there a function I can use in Modify stage to either concatenate or convert the source columns to single timestamp output column?

Thanks,
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

What happens when you use StringtoDate and StringtoTime functions? Does it help?
Kris

Where's the "Any" key?-Homer Simpson
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

After date_from_string() and time_from_string() in one Modify stage you will need a second Modify stage to apply timestamp_from_date(). Two adjacent Modify stages are not permitted so you will need a Copy stage between them.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

Instead of two modify stages and one copy satge , is it not better to use one transformer?

In the transformer, the below function works with dummy time

StringToTimestamp(To.SrcDate: " 000000","%yyyy%mm%dd %hh%nn%ss")

but when I replace the " 000000" with a column it gives me *********

StringToTimestamp(To.SrcDate: To.SrcTime,"%yyyy%mm%dd %hh%nn%ss")

The SrcTime has values like 124643,130216,125553.

Thanks for the help.
Thanks,
Vinay
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

Hi,

I have got it working with the below format in a transformer, I was missing the space between the two columns when I concatenate them.

StringToTimestamp(To.SrcDate:' ':To.SrcTime,"%yyyy%mm%dd %hh%nn%ss")

Old format was

StringToTimestamp(To.SrcDate:To.SrcTime,"%yyyy%mm%dd %hh%nn%
ss")

Now will see if I can get it working in one Modify stage.
Thanks
Thanks,
Vinay
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You will not be able to get it to work in one Modify stage for reasons already stated. The Modify stage does not support nested functions.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply