String to decimal conversion problem

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

Post Reply
vasam
Participant
Posts: 30
Joined: Wed Nov 04, 2009 5:06 am

String to decimal conversion problem

Post 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
vijayakumargoud
behrouz
Participant
Posts: 41
Joined: Tue Oct 28, 2008 4:13 am

Re: String to decimal conversion problem

Post 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
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Re: String to decimal conversion problem

Post 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.
Phil Hibbs | Capgemini
Technical Consultant
Post Reply