T-SQL Numeric function
In T-SQL, a Numeric function is applied to numeric data and returns digital data.
The types of Numeric function are given below:
- ABS ()
The absolute value is returned as the output of the numeric expression.
The query returns the absolute value.
- ACOS ()
The arc cosine value is returned as the output of the numeric expression that is specified.
The below code generates the arc cosine value of 0.
Arc sine value is returned as the output of the specific numeric value expression.
The query gives the arc sine value of 0.
- ATAN ()
The arc tangent value is returned as the output of the specific numeric expression.
The query returns an arc tangent value 0
- ATN2 ()
The Arc tangent value in all the four quadrants comes as the output for the specified expression.
The below query gives the arc tangent value in the four quadrants of 0.
See the EMPLOYEES table, which has these records.
- BETWEEN ()
If the value exists between the two expressions, then the below output will come.
Where salary is between 20000 and 85000.
The minimum value will occur as the output from the given expression.
The query gives ‘15000.00’ for the ‘salary‘ expression from the Employee table.
- MAX ()
The maximum value is returned as the output of the expression.
The below code will give ‘20000.00‘ for the ‘salary‘ expression from the customer’s table.
- SQRT ()
The square root of the numeric expression is returned as the output.
It gives 2 for the 4 numeric expressions.
The PI() function generates the numeric output.
The below query gives 3.14159265358979 for the PI value.
The CEILING () function returns the output after rounding of the decimals, which is the next highest value of the table.
The query gives 235 for the given 234.25 value.
The function generates the output after rounding of the decimals, which is equal to or less than the expression value.
The query gives 231 for the given 231.34 value.
- LOG ()
The natural logarithm of the expression is returned as the output.
The below query will give 0 for the given one value.