SQL Server Varchar Date to Oracle 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
Childrensmn
Premium Member
Premium Member
Posts: 32
Joined: Mon Apr 12, 2010 3:42 pm
Location: Minneapolis
Contact:

SQL Server Varchar Date to Oracle Timestamp conversion

Post by Childrensmn »

I have spent considerable time trying to fix that but get error message.
I have Claim_St_Dt coming as Varchar from SQL Server (Here is how the date comes as "08/22/2013". Just date no time.
I want to insert this into Oracle table with Timestamp datatype.
50% of the rows are NULL for this column.

I tried "StringToTimestamp", "StringToTimestamp : " 00:00:00", OConv/Iconv in the transformer but nothing seems to be working.

Here is the error in the log file:
"APT_CombinedOperatorController,0: Data string '08/22/2013' does not match format '%yyyy %mm %dd %hh %nn %ss': the value for tag %yyyy has fewer characters than expected."

What am I doing wrong? In other job, I have a similar datatype coming out of SQL Server (same format: 08/22/2013) and StringToTimestamp works fine. Not in this job though..

Thanks for your help.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Your default format string for timestamp expects YMD order but you are providing MDY order. That's basically what you're doing wrong.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

also I think you need to mention "/" as well. Something like below

Code: Select all

StringToTimeStamp(Claim_St_Dt:" 00:00:00","%mm/%dd/%yyyy %hh:%nn:%ss")
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Childrensmn
Premium Member
Premium Member
Posts: 32
Joined: Mon Apr 12, 2010 3:42 pm
Location: Minneapolis
Contact:

Post by Childrensmn »

This worked:

StringToTimestamp(CLAIM_ST_DT, "%mm/%dd/%yyyy") : " 00:00:00"
Post Reply