String to timestamp conversion

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
wjfitzgerald
Participant
Posts: 72
Joined: Tue Feb 05, 2008 4:38 am

String to timestamp conversion

Post by wjfitzgerald »

Hi,

I am constructing a timestamp from two input fields, inp_date and inp_time, and from a literal of '00'. by way of manipulation i am populating a stage variable, DateRed, with the time stamp in the format
%yyyy-%mm-%dd %hh:%nn:%ss.6. an exapmle of the string would be 2008-05-01 21:21:305600. so i am trying to do the convert as stringtotimestamp(DateRed, '%yyyy-%mm-%dd %hh:%nn:%ss.6').
As you can see i am trying to get the output to include micro seconds.

I am writing the output to a sequential file currently, just to check the output. the time stamp is coming out but is not carrying the micro seconds beyond the first 2 digits.

Any thoughts or suggestions would be welcomed.
Ultimately looking to sort the file by this field so need it to be correct.

Thanks

JOhn Fitz
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

In your output sequential file timestamp column definition, do an "edit row" and add "%yyyy-%mm-%dd %hh:%nn:%ss.6" as your display conversion, that should do it.
wjfitzgerald
Participant
Posts: 72
Joined: Tue Feb 05, 2008 4:38 am

Post by wjfitzgerald »

great thanks, will try that straight away.
John Fitz
wjfitzgerald
Participant
Posts: 72
Joined: Tue Feb 05, 2008 4:38 am

Post by wjfitzgerald »

Sorry now, which field is the display conversion entered into? in the edit column meta data window i only have the following fields available
Column name
key
sql type
lenght
scale
nullable
native type
description
John Fitz
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Timstamp Type -> Format String.

Also, have you enabled the "Extended Microseconds" switch or the "extended" attribute in the column definition for the timestamp?
wjfitzgerald
Participant
Posts: 72
Joined: Tue Feb 05, 2008 4:38 am

Post by wjfitzgerald »

lets assume i haven't!!!
any chance you know what that indicator is called?

thanks
john fitz
wjfitzgerald
Participant
Posts: 72
Joined: Tue Feb 05, 2008 4:38 am

Post by wjfitzgerald »

just to summarise then

when you define the field as timestamp, in the extented attribute you can set the microseconds on, simple as that

thanks to all

regards
john fitz
Post Reply