Loading...

Function in SQL Server is a object that is used to perform a specific task. 
Like count of rows in table, sum of columns or finding maximum and minimum values in SQL Tables. 

Mainly two type of function in SQL Server:

  1. System Defined Function
  2. User Defined Function

1) System Defined Function: 
The function which is already provided by SQL Server to perform some specific task is known as system defined function. System defined function, we can use directly in our SQL Query. 

Some system defined function are below:

Count: This function gives the number of rows in table. 
select count(*) from Students

Max: This function is used to get maximum values of given column of table.
select max(rollno) from Students 

Min: This function is used to get minimum values of given column of table.
select min(rollno) from Students 

Len: This function is used to count the length of values in specified column.
select len(Name) from Students