I just found out that the MAX() function in SQL only works on columns.
Is there a similar function I can use to find the max value out of e.g. these four variables?
SET @return = MAX(@alpha1, @alpha2, @alpha3, @alpha4)
Or do I have to put them in a column first (and thus create a table first…;-( )?
Regards
Lumpi
There is no built-in function in T-SQL for this but you can use following
or (SQL Server 2008+)