What are all types of user defined functions?

Total Post:7

Points:35
 38  View(s)
Ratings:
Rate this:
  1. Post:7

    Points:35
    What are all types of user defined functions?

    Three types of user defined functions are. :

    • Scalar Functions.
    • Inline Table valued functions.
    • Multi statement valued functions.
    Example :-
    CREATE FUNCTION dbo.udf_GetProductSales
    (
          @Product VARCHAR(10), 
          @BeginDate DATETIME, 
          @EndDate DATETIME 
    )
    RETURNS MONEY
    AS
    BEGIN
          DECLARE @Sales MONEY
          SELECT @Sales = SUM(SalePrice) 
          FROM SalesHistory
          WHERE
                Product = @Product AND
    SaleDate BETWEEN @BeginDate AND @EndDate
          RETURN(@Sales)
    END

      Modified On May-06-2019 05:30:04 AM

Answer