Conversion of Varchar(yymmdd) 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
spallam
Participant
Posts: 7
Joined: Thu Mar 29, 2007 5:48 am
Location: nellore

Conversion of Varchar(yymmdd) to timestamp

Post by spallam »

Hi All,
In sequential file(source) ,one of the column is of varchar adatatype and sample data comimg is 071109 which represents 07 is year,11 is month ,09 is day.

The requirement is to load the above column data into oracle table and the dataype is timestamp in table.

Case: 1
Using ----StringToTimestamp('20':DSLink40.TODAYS_BUSINESS_DATE: " 00:00:00","%yyyy%mm%dd:%hh:%nn:%ss")---
Result :Th data is loading intpo table ,but it is not giving correct year when source data is 991109.


Case: 2
Using ----StringToTimestamp(DSLink40.TODAYS_BUSINESS_DATE: " 00:00:00","%yy%mm%dd:%hh:%nn:%ss")--- .

Result :Th data is loading into table but year is showing as 1907 when the source data is 071109.



Please suggest the correct way to load the source data
into table as timestamp.
dsusr
Premium Member
Premium Member
Posts: 104
Joined: Sat Sep 03, 2005 11:30 pm

Re: Conversion of Varchar(yymmdd) to timestamp

Post by dsusr »

For Case 1:-

---- If you are sure that all your dates are of this century then your first transform will work correctly but I think there are spaces coming in the input column due to which its giving the wrong answer. So just use the following transform

StringToTimestamp('20':Trim(DSLink40.TODAYS_BUSINESS_DATE): " 00:00:00","%yyyy%mm%dd %hh:%nn:%ss")

For Case 2

--- Can you please check the value of CENTURYPIVOT in uvconfig file. Although this value is basically for ICONV but since I am not currently having a PX installation so can't check whether this effects the StringToTimestamp function as well.

----------
dsusr
Post Reply