Pinal Dave, in his site, posted an interesting solution on finding out maximum number between two numbers. Here are some alternate methods that I know
Method 1 : Use max function
declare @value1 decimal(5,2) = 9.22
declare @value2 decimal(5,2) = 8.34
select max(val) from
(
select @value1 as val union all
select @value2
) as t
Method 2 : Use Top function
declare @value1 decimal(5,2) = 9.22
declare @value2 decimal(5,2) = 8.34
select top 1 val from
(
select @Value1 as val union all
select @Value2
) as t order by val desc
Method 3 : Use VALUES clause(applicable from version 2008 onwards)
Find more information about it here
declare @value1 decimal(5,2) = 9.22
declare @value2 decimal(5,2) = 8.34
select max(val) from (values (@Value1),(@Value2)) as t(val)
Method 4 : Use row_number() function(applicable from version 2005 onwards)
Findout what you can do with row_number function here
declare @value1 decimal(5,2) = 9.22
declare @value2 decimal(5,2) = 8.34
select val from
(
select val,row_number() over (order by val desc) as sno from
(
select @value1 as val union all
select @value2
) as t
) as t
where sno=1