Page 1 of 1

StringtoDecimal Issue

Posted: Thu Mar 19, 2009 10:01 am
by pavankvk
Hi

I am reading a file with decimal vales in a column. Reading the column as vachar.

Record 1 : col: 70.4582
Record 2 : col : 1.234 etc

Using StringToDecimal with trunc_zero. and writing to peek as 10,7

I see the output always as 000.0000000

Posted: Thu Mar 19, 2009 10:56 am
by Sainath.Srinivasan
StringToDecimal with trunc_zero ?

Posted: Thu Mar 19, 2009 11:24 am
by pavankvk
Sainath.Srinivasan wrote:StringToDecimal with trunc_zero ?
I guess thats the default.

Even i specify it or not, i don't see any difference.

When i hard code some string like "1234.456" in the StringtoDecimal, it works fine,but it doesn't work with my input

Posted: Thu Mar 19, 2009 11:45 am
by pavankvk
found the issue. its due to 0d hex in the column, took left(col,length(col)-1) and used that as input to stringtodecimal function.

Posted: Thu Mar 19, 2009 12:39 pm
by chulett
Is that because you're reading a 'DOS' file and not handling the record delimiter properly? :?

Posted: Thu Mar 19, 2009 12:45 pm
by dipanzan
Reading the file as a DOS fomatted file might have solved the problem..

Posted: Thu Mar 19, 2009 12:51 pm
by pavankvk
dipanzan wrote:Reading the file as a DOS fomatted file might have solved the problem..
Thanks for reminding, I completely forgot about that.been a while i handled dos files :D

Posted: Thu Mar 19, 2009 12:53 pm
by pavankvk
dipanzan wrote:Reading the file as a DOS fomatted file might have solved the problem..
Thanks for reminding, I completely forgot about that.been a while i handled dos files :D