What is First_Value Function in SQL Server?


First_Value Function return first value in an ordered set of values in SQL Server 2012.This function must have an OVER clause.
Syntax:
FIRST_VALUE(Column_Name) Over (Order By Column_Name ASC)
Example:

Create table #Temp
(
  ID  int identity(1,1) ,
  EmployeeName varchar(100),
  Age int 
) 
Insert into #Temp(EmployeeName,Age)
Select 'Hitesh',25 union
Select 'Priyanka',23 union
Select 'Dev',33 union
Select 'Neha',25 union
Select 'Abhimanyu',22 union
Select 'Bhawesh',30


SQL Query using FIRST_VALUE Function

Select ID,
EmployeeName,
Age,
FIRST_VALUE(Age) OVER (ORDER BY EmployeeName ASC) from #Temp


Result:
This Result will return 22.