Page 1 of 2

Converting string to date!!

Posted: Tue Sep 14, 2010 12:23 pm
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...

Re: Converting string to date!!

Posted: Tue Sep 14, 2010 12:37 pm
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.

Re: Converting string to date!!

Posted: Tue Sep 14, 2010 12:47 pm
by allavivek
I was developing job in parallel..

Oconv and Iconv functions are not present in parallel..

thank you..

Posted: Tue Sep 14, 2010 12:53 pm
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.

Posted: Tue Sep 14, 2010 1:07 pm
by kbsuryadev
What is the input data type/length and is the output data type (DATE) ?

Posted: Tue Sep 14, 2010 1:15 pm
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.

Posted: Tue Sep 14, 2010 1:46 pm
by kbsuryadev
what is your output(database/file)

Posted: Tue Sep 14, 2010 1:48 pm
by allavivek
kbsuryadev wrote:what is your output(database/file)
output is file..

Posted: Tue Sep 14, 2010 1:58 pm
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)

Posted: Tue Sep 14, 2010 2:27 pm
by allavivek
Still error is there...

Posted: Tue Sep 14, 2010 2:31 pm
by mhester
Would you please post an actual date value?

Posted: Tue Sep 14, 2010 2:41 pm
by kbsuryadev
please post the error.

Posted: Tue Sep 14, 2010 2:43 pm
by allavivek
mhester wrote:Would you please post an actual date value?

its like

12/03/2010

format

i need 2010/03/12 format...

Posted: Tue Sep 14, 2010 2:44 pm
by allavivek
kbsuryadev wrote:please post the error.
Transformer_86,0: Conversion error calling conversion routine date_from_string data may have been lost

Posted: Tue Sep 14, 2010 2:44 pm
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