how can we convert negative a number to positive number in SQL Server 2005/2008.

3 Comments | 7948 Views | Post by: Admin | Tags: ABS function, negative a number to a positive number, use ABS function


In this post, We will learn to convert a negative number to positive number. ABS function is the SQL function, which will convert the negative number to positive one.The example can be create in any edition of Ms-SQL Server like MS-SQL Server 2005/2008. A SQL Script has been attached with the article.


If we wan to convert a number to positive number then we can use the ABS function hwich will convert the negative number to positive one.

Follow the following below steps to convert a negative a number to positive number in SQL Server 2005/2008

Step1: Open the SQL Server 2008 Edition

Alternate Text

Step 2: Create a new script(test databse or select any pre created database for the testing purpose )

Alternate Text

Step 3: Write the following SQL statement, I have used the ABS function there to a number to positive number in SQL Server 2005/2008

SELECT ABS(-2.0) -- NEGATIVE VALUES
SELECT ABS(0.0)
SELECT ABS(2.0)

Step 4: Output as we needed.

Alternate Text

so guys, we have learned in this tutorial, how we can convert negative a number to positive number in SQL Server 2005/2008.

Download Source Codes


Post Comments

if you have some suggestion, question, request on how can we convert negative a number to positive number in SQL Server 2005/2008..

Please use the comment box to express your views.

 

Comments:

loading...