SQL CREATE FUNCTION

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • CREATE FUNCTION function_name ( [list_of_paramenters] ) RETURNS return_data_type AS BEGIN function_body RETURN scalar_expression END

Parameters

ArgumentDescription
function_namethe name of function
list_of_paramentersparameters that function accepts
return_data_typetype that function returs. Some SQL data type
function_bodythe code of function
scalar_expressionscalar value returned by function

Remarks

CREATE FUNCTION creates a user-defined function that can be used when doing a SELECT, INSERT, UPDATE, or DELETE query. The functions can be created to return a single variable or a single table.



Got any SQL Question?