This simple stored procedure calculates the area & circumference of a circle using radius—an ideal example for beginners. It’s designed to spark interest in those just starting their journey with SQL Server and T-SQL programming.
/********************************************************************
Description  : Procedure to calculate Area and Circumference of a Circle
 Definition   : 
 - Area of Circle = π × Radius²  
   Represents the total surface covered inside the boundary of the circle.
 - Circumference of Circle = 2 × π × Radius  
   Represents the total distance around the circle (its perimeter).
 Purpose      :
 - Accepts the radius as input
 - Calculates both area and circumference of the circle
 - Returns results using OUTPUT parameters
 Parameters   :
 - @Radius         [INPUT]  : Radius of the circle
 - @Area           [OUTPUT] : Calculated area using π × r²
 - @Circumference  [OUTPUT] : Calculated circumference using 2 × π × r
 ********************************************************************/
CREATE PROCEDURE dbo.Calculate_Circle_Area_Circumference
    @Radius FLOAT,
    @Area FLOAT OUTPUT,
    @Circumference FLOAT OUTPUT
AS
BEGIN
    SET NOCOUNT ON;
    DECLARE @PI FLOAT = 3.14159265;
    SET @Area = @PI * @Radius * @Radius;
    SET @Circumference = 2 * @PI * @Radius;
END
Execution of Stored Procedure
USE [BI_Reporting]
GO
DECLARE	@return_value int,
		@Area float,
		@Circumference float
EXEC	@return_value = [dbo].[Calculate_Circle_Area_Circumference]
		@Radius = 5,
		@Area = @Area OUTPUT,
		@Circumference = @Circumference OUTPUT
SELECT	@Area as N'Area of Circle',
		@Circumference as N'Circumference  of Circle'
SELECT	'Return Value' = @return_value
GO
