How to get max value in a row in SQL Server?


create table #Rpt
(
  iID  int identity(1,1),
  salary int,
  age int
)

insert into #Rpt values(100,20)
insert into #Rpt values(100,120)
insert into #Rpt values(120,20)

select * from #Rpt

Select (Select Max(P) from (Values (salary),(age)) as value(P)) As maxValue from #Rpt

Output :
maxValue
100
120
120