SQL Server ABS() function syntax with example

SQL Server ABS() function

In the previous post we have learn the SIGN() function in the SQL server. Now, we are going to learn ABS() function in the sqlserver. In the below query, we will get the absolute negative and positive values.
This is one of the SQL Server Interview Question.

Below program Output:
SQL Server ABS() function syntax with example
SQL Server ABS() function syntax with example


CREATE TABLE ExampleTable ( num INT )
INSERT INTO ExampleTable VALUES ( -2), (-1), (0), (NULL), (1)
SELECT num,
num * SIGN(num) AS [numxSign(num)],
ABS(num) AS [absolutevalue]
FROM ExampleTable



Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar