Page 1 of 1

How to convert negative values into positive

Posted: Mon May 17, 2010 1:46 pm
by vemisr
Hi Experts,

i have few negative values and positive values in few columns, i need to convert them into positive.

i.e

-75555123 this need to be 75555123
555124 should be 555124


is there any function. i was tried with Abs() but i didn't get any conversions.

Thanks
Vemisr

Posted: Mon May 17, 2010 1:53 pm
by anbu
Abs function should work. What did you get?

Posted: Mon May 17, 2010 4:01 pm
by chulett
How exactly did you use it? That is what you want after all, the absolute value.

Posted: Fri Jul 09, 2010 4:15 am
by sridinesh2009
chulett wrote:How exactly did you use it? That is what you want after all, the absolute value. ...
you can use fabs function...it converts negative to positive

Posted: Fri Jul 09, 2010 5:09 am
by Sainath.Srinivasan
Or write one yourself as

Code: Select all

  If yourField < 0 Then yourField * (-1) Else yourField

Posted: Fri Jul 09, 2010 5:52 am
by mayura
Sainath.Srinivasan wrote:Or write one yourself as

Code: Select all

  If yourField < 0 Then yourField * (-1) Else yourField
...
or use field function to convert all negative sign to positve and then load into target :idea:

Posted: Fri Jul 09, 2010 6:01 am
by Sainath.Srinivasan
mayura wrote:
Sainath.Srinivasan wrote:Or write one yourself as

Code: Select all

  If yourField < 0 Then yourField * (-1) Else yourField
...
or use field function to convert all negative sign to positve and then load into target :idea:
Don't take me wrong...what does a field function go to do here ?

Posted: Fri Jul 09, 2010 6:22 am
by Sreenivasulu
Mayura is suggesting an additional solution :)

Posted: Fri Jul 09, 2010 6:29 am
by chulett
Also known as an invalid solution unless they can explain it. :?

Never mind the fact that the simple and proper solution has already been posted, there's no need for some kind of an 'Alternate Solution Contest' here and no prize for the goofiest... sorry. :wink:

Posted: Fri Jul 09, 2010 8:50 am
by dsx999
Some people are slowly changing the DSXchange to a "knowledge(?) expo" from a "knowledge base" with their over-excitement. In a recent post, I asked a very simple question and got only 2 solutions and around 10 other useless comments. Please think neotically before throwing some garbage.
It doesn't even help anybody's learning process also. Just shows the false-ego, earned with a little knowledge.

We have technology's best people here. So let us show some respect to them with sensible environment.

I know my comments are a bit rude. Sorry for that.

Posted: Fri Jul 09, 2010 6:07 pm
by ray.wurlod
Abs() works - provided that the argument is numeric and not null.