Page 1 of 1

String to decimal conversion problem

Posted: Mon Sep 20, 2010 1:21 am
by vasam
Hi
I have source varchar(255) value 123456789123456789 , i am trying to converting this varchar to decimal (18.2) , but i am unble to converting.

I am getting output like all zeros.(0000000000000000.00 )

Any suggessions
Thanks in advance

Re: String to decimal conversion problem

Posted: Mon Sep 20, 2010 2:02 am
by behrouz
How do you do your convert?
AsDouble(...) or stringToDecim??

isnt it better to do a trim before or use varchar(20)? have u tried those one?
I think it is cause because of blank or some space
hop this helps
Best regards
Arash

Re: String to decimal conversion problem

Posted: Mon Sep 20, 2010 2:14 am
by PhilHibbs
vasam wrote:Hi
I have source varchar(255) value 123456789123456789 , i am trying to converting this varchar to decimal (18.2) , but i am unble to converting.
By 18.2 do you mean Length 18, Scale 2? If so, that's too small to fit 123456789123456789 in. You need Length 20, Scale 2 or Length 18, Scale 0.