Menu

SQL Server COT() Function

COT() returns the cotangent of an angle measured in radians. The input must be a float or a type SQL Server can implicitly convert to float; the return type is float. See Microsoft’s COT() reference.

Syntax

COT(float_expression)

float_expression is the angle in radians.

Examples

At π/4 radians, the cotangent is 1:

SELECT COT(PI() / 4) AS cotangent;
cotangent
1.0

When the angle is in degrees, convert it to radians first. Cast integer inputs to float so RADIANS() retains the fractional value:

SELECT COT(RADIANS(CONVERT(float, 45))) AS cot_45_degrees;

The result is approximately 1.0. For tangent, see TAN().