Page 1 of 1

Problem converting String to Decimal

Posted: Thu Sep 18, 2008 7:49 am
by sshettar
Hi All,

I have this file which has a field of type char(8) . i need to convert this into decimal[7,2].

Well i am using stringtodecimal() funtion in the transformer right now .
It seems to work perfectly fine all most of the records and just in case if the filed had any value which could not be cnverted to a decimal then its putting out as 00000.00

The strange thing here is for 3 records this funvtion is throuwing 00000.00 values after conversion .
but the data seems to be right for conversion into a decimal .

The values as as below

-005500 |ABC |
0303030 |1DFG2001 |
0205505 | |
0105516 | |

Of these two filed the feild i'm looking at is the first field which has to be converted into decimal.

our job is able to read the first record properly as a decimal value as
-05500.00 but not the rest of the records as its throwing in 00000.00 value for the rest

ANy help on this is highly appreciated

Posted: Fri Sep 19, 2008 10:43 pm
by ambasta
You have defined your source metadata as Char[8] ,but i can see the data is only of 7 digits..is the last digit a null or space..if it is... then you will not be able to convert it into decimal...
Change the source metadata to varchar and then try..