Converting string to date!!

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

allavivek
Premium Member
Premium Member
Posts: 211
Joined: Sat May 01, 2010 5:07 pm

Converting string to date!!

Post by allavivek »

Hi All,

while i was converting from varchar to date i was getting following warning.
Transformer_86,0: Conversion error calling conversion routine date_from_string data may have been lost

and getting ****** as output
By searching the previous posts i tried

input is in format 03/13/2010 and i want in 2010/03/13 format.

StringToDate(Trim(DSLink92.ProcessDate,' ','A'),"%yyyy/%mm/%dd")

but the warning still exists...

Any Suggestions...
routhu
Participant
Posts: 6
Joined: Mon Sep 13, 2010 3:33 pm

Re: Converting string to date!!

Post by routhu »

hi vivek,

trying using OconV & IconV Functions in the transformer

something like ---- Oconv(Iconv("03/13/2010", "D/MDY[2,2,4]"), "D/YMD") in the transformer derivation ..
it should work.
Madhu Routhu
allavivek
Premium Member
Premium Member
Posts: 211
Joined: Sat May 01, 2010 5:07 pm

Re: Converting string to date!!

Post by allavivek »

I was developing job in parallel..

Oconv and Iconv functions are not present in parallel..

thank you..
mhester
Participant
Posts: 622
Joined: Tue Mar 04, 2003 5:26 am
Location: Phoenix, AZ
Contact:

Post by mhester »

You are experiencing a conversion failure of some sort. Either the string coming in will not convert to a date or the format you have defined does not match the data.
kbsuryadev
Premium Member
Premium Member
Posts: 46
Joined: Wed Jun 06, 2007 10:32 am

Post by kbsuryadev »

What is the input data type/length and is the output data type (DATE) ?
allavivek
Premium Member
Premium Member
Posts: 211
Joined: Sat May 01, 2010 5:07 pm

Post by allavivek »

kbsuryadev wrote:What is the input data type/length and is the output data type (DATE) ?
input datatype is varchar. lenght not mentioned any thing.

iam trying to convert to date.
kbsuryadev
Premium Member
Premium Member
Posts: 46
Joined: Wed Jun 06, 2007 10:32 am

Post by kbsuryadev »

what is your output(database/file)
allavivek
Premium Member
Premium Member
Posts: 211
Joined: Sat May 01, 2010 5:07 pm

Post by allavivek »

kbsuryadev wrote:what is your output(database/file)
output is file..
kbsuryadev
Premium Member
Premium Member
Posts: 46
Joined: Wed Jun 06, 2007 10:32 am

Post by kbsuryadev »

try input using varchar(10) and output as date

derivation : StringToDate(input,"%mm/dd/yyyy%")

If you have nulls coming from source then handle it

Go to output file under columns double click on the left of the output column which will open the edit column meta data window where you can specify the format you want

under datatype - format string(%yyyy/%mm/%dd)
allavivek
Premium Member
Premium Member
Posts: 211
Joined: Sat May 01, 2010 5:07 pm

Post by allavivek »

Still error is there...
mhester
Participant
Posts: 622
Joined: Tue Mar 04, 2003 5:26 am
Location: Phoenix, AZ
Contact:

Post by mhester »

Would you please post an actual date value?
kbsuryadev
Premium Member
Premium Member
Posts: 46
Joined: Wed Jun 06, 2007 10:32 am

Post by kbsuryadev »

please post the error.
allavivek
Premium Member
Premium Member
Posts: 211
Joined: Sat May 01, 2010 5:07 pm

Post by allavivek »

mhester wrote:Would you please post an actual date value?

its like

12/03/2010

format

i need 2010/03/12 format...
allavivek
Premium Member
Premium Member
Posts: 211
Joined: Sat May 01, 2010 5:07 pm

Post by allavivek »

kbsuryadev wrote:please post the error.
Transformer_86,0: Conversion error calling conversion routine date_from_string data may have been lost
kbsuryadev
Premium Member
Premium Member
Posts: 46
Joined: Wed Jun 06, 2007 10:32 am

Post by kbsuryadev »

sorry i forgot these % in the code

try this in the derivation

StringToDate(input,"%mm/%dd/%yyyy")

and do the same in the output as i mentioned in the other reply
Post Reply