función almacenada en SQL

CREATE [OR ALTER] FUNCTION <FNAME> (@<PARAMETER NAME1><DATATYPE>[SIZE]
RETURNS <return PARAMETER / ATTRIBUTE /VARIABLE DATATYPE>
AS
BEGIN
<FUNCTION BODY / STATEMENTS>
RETURN <return PARAMETER/ATTRIBUTE/VARIABLE NAME>
END
ekkamrit