Create a Function in sql server

Ranjeet_8
Posted by Ranjeet_8 under Sql Server category on | Points: 40 | Views : 907
Syntax of Function

CREATE FUNCTION YourFunction_Name()
RETURNS Decimal(6, 2) // Set your return type
AS
BEGIN
// your calculation here.
RETURN 944.22 // return your value
END;
GO

Below is the example of Function :

CREATE FUNCTION YourFunction_Name()
RETURNS Decimal(6, 2)
AS
BEGIN
RETURN 944.22
END;
GO

Comments or Responses

Login to post response