SQL Server PI() Function

The PI() function in SQL Server returns the value of the mathematical constant pi (π), which is the ratio of a circle's circumference to its diameter. It's approximately 3.14159.



PI(): Definition and Usage

PI() is a simple function for retrieving the value of pi. It's incredibly useful when you're working with circles, spheres, or other geometric shapes in your calculations, or in any situation where the value of pi is needed in your SQL queries.

Syntax

Syntax

PI()
      

Related Functions

For converting between radians and degrees, see the DEGREES() and RADIANS() functions.

Example

Retrieving the Value of Pi

This query demonstrates how to obtain the value of pi using the PI() function.

Syntax

SELECT PI();
      
Output

3.14159265358979
      

**Note:** The output value is an approximation of pi, and the precise value might vary very slightly depending on your SQL Server version. The value is returned as a floating-point number.