What is function in SQL server ?

Total Post:55

Points:275

 251  View(s)
Ratings:
Rate this:
  1. What is function in SQL server ?

    That is the SQL Functions are a database object in SQL Server. Mainly, it is a set of SQL statements that accept only input parameters, perform actions and return the result. A function can return only a single value or a table. You can’t use a function to Insert, Update, Delete records in the database tables.

    Example:- 

    CREATE OR REPLACE FUNCTION totalCustomers 
    
    RETURN number IS
       total number(2) := 0;
    BEGIN
       SELECT count(*) into total
       FROM customers;

       RETURN total;
    END; 

Answer