TAN() and COT() Function in SQL Server


TAN() Function: The TAN() function in SQL Server is used to return the tangent of an angle. It takes a single argument, which is the angle in radians, and returns the tangent of that angle.

Syntax:

TAN ( numeric_expression )

Example:

SELECT TAN(0.5) AS TangentValue;

Output:

TangentValue
0.54630248984379

COT() Function: The COT() function in SQL Server is used to return the cotangent of an angle. It takes a single argument, which is the angle in radians, and returns the cotangent of that angle.

Syntax:

COT ( numeric_expression )

Example:

SELECT COT(0.5) AS CotangentValue;

Output:

CotangentValue
1.83048772171245

Note: Both TAN() and COT() functions take the angle in radians as input. If the angle is in degrees, it needs to be converted to radians before passing it to these functions. This can be done using the RADIANS() function in SQL Server.



About the author

William Pham is the Admin and primary author of Howto-Code.com. With over 10 years of experience in programming. William Pham is fluent in several programming languages, including Python, PHP, JavaScript, Java, C++.