6> CREATE FUNCTION dbo.linear_max
7> (
8> @arg1 AS int,
9> @arg2 AS int
10> )
11> RETURNS int
12> AS
13> BEGIN
14> RETURN CASE
15> WHEN @arg1 >= @arg2 THEN @arg1
16> WHEN @arg2 > @arg1 THEN @arg2
17> ELSE NULL
18> END
19> END
20> GO
1>
2> SELECT
3> dbo.linear_max(1, 2)
4>
5> drop function dbo.linear_max
6> GO
-----------
2
(1 rows affected)
1>
2>