Mathematical Functions are built-in scalar functions that perform calculations depending on input values provided as arguments and return a numeric value.
We’ll go through the mathematical functions that SQL Server has to offer in this and the following posts.
SELECT ABS(-19.99)
Returns: 19.99
This function returns the absolute value of X.
SELECT ACOS(0)
Returns: 1.5707963267949
The above function takes a Cos value as an argument and returns a radian angle.
Only values between -1.00 and 1.00 are valid. No value is returned for values outside of this range, and ACOS will report a domain error.
SELECT ASIN(1)
Returns: 1.5707963267949
This function takes a Sin value as an argument and returns a radian angle.
Only values between -1.00 and 1.00 are valid. No value is returned for values outside of this range, and ASIN will report a domain error.
SELECT ATAN(1)
Returns: 0.785398163397448
The above function, which takes a Tan value as an input, returns the angle in radians. The type float or a type that transforms to a float expression implicitly.
SELECT ATN2(45.12,1.2)
Returns: 1.54420685014236
The above function returns the angle between the positive x-axis and the ray from the origin to the point (y, x), in radians, where x and y are the values of the two provided float expressions.
SELECT CEILING(6.8)
Returns: 7
The above function returns greatest integer value that is either less than or equal to X.
SELECT COS(0)
Returns: 1
The above function takes a radian angle as an input and returns the angle’s Cosine value. In other words, the trigonometric cosine of the supplied angle – measured in radians – in the specified statement is returned by this mathematical function.
The continuation post can be found here.
One comment