Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Return numeric value all as +ve numbers

Author  Topic 

zeeshan13
Constraint Violating Yak Guru

347 Posts

Posted - 2008-05-16 : 11:09:44
Hi All,

I have a table Called Elasticity. Including some other fields it has a field called ElastVal of decimal type (2 places). The records for just this field are like this (example);

ElastVal
-450.88
-32.99
1.22
56.77
0.99


In my select I want to return all the fields from the Elasticity table including Elasticity in a way that even the negative numbers will be reterive as positive.

So in the above example the output should be;
ElastVal
450.88
32.99
1.22
56.77
0.99

How Can I do this in my select?

Please help.

Zee



GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-05-16 : 11:27:54
Use the ABS function. Returns the absolute value (value without a sign) of what you pass to it

--
Gail Shaw
Go to Top of Page

zeeshan13
Constraint Violating Yak Guru

347 Posts

Posted - 2008-05-16 : 11:51:36
Thanks for the hint...

The following is working...

SELECT ABS(ElastVal) ElastVal FROM Elasticity
Go to Top of Page
   

- Advertisement -