Convert string to time with milliseconds

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
SakthiSahithi
Participant
Posts: 2
Joined: Fri Jan 04, 2013 5:53 am

Convert string to time with milliseconds

Post by SakthiSahithi »

Hi,

Am trying to convert the char field to time field in transformer stage.

The char field data format is hh:nn:ss.N

Eg: 00:00:09.2570000

I need the same value in target column "00:00:09.2570000" with datatype as time
If I directly change the data type to time in target column with length 16 and scale 7, am not getting the milliseconds part. Am only getting "00:00:09"

I tried below option

stringtotime('Columnname',"hh%nn%ss.n")

Kindly help

Thanks
R Sakthi
chandra.shekhar@tcs.com
Premium Member
Premium Member
Posts: 353
Joined: Mon Jan 17, 2011 5:03 am
Location: Mumbai, India

Post by chandra.shekhar@tcs.com »

First things first, did you try to search your issue ?
There are atleast hundreds of posts with exactly same issue.
Even then, try this

Code: Select all

StringToTime('Columnname',"hh%nn%ss.6")
Also enable the microseconds at the metadata level in the transformer.
Thanx and Regards,
ETL User
SakthiSahithi
Participant
Posts: 2
Joined: Fri Jan 04, 2013 5:53 am

Post by SakthiSahithi »

Yes. I tried many options and none of them worked... All are skipping the milliseconds part
R Sakthi
chandra.shekhar@tcs.com
Premium Member
Premium Member
Posts: 353
Joined: Mon Jan 17, 2011 5:03 am
Location: Mumbai, India

Post by chandra.shekhar@tcs.com »

Did u enable the microseconds at the metadata level in the transformer ?
Thanx and Regards,
ETL User
rsripathy
Participant
Posts: 21
Joined: Wed Sep 19, 2007 8:46 am

Post by rsripathy »

SakthiSahithi wrote:Yes. I tried many options and none of them worked... All are skipping the milliseconds part
What is your Target , is it Database or file ?

As specified by Chandra , you can use StringToTimestamp('Columnname',"hh%nn%ss.3") will work.
Enable Extended propery to "milliseconds"

if your target is database, then you need to check your DSN properties.
Post Reply