You don't need the case statement, because a null input parameter will return a null result.It would be better to do this as inline code; a scalar UDF would be much slower.select a.*, Result = a.Price*($1.00-(a.Discount*$.01))from ( -- Test Data select price = $18, Discount = 3 union all select price = null, Discount = 3 union all select price = $18, Discount = null ) a
Results: price Discount Result--------------------- ----------- --------------------- 18.00 3 17.46 NULL 3 NULL 18.00 NULL NULL
CODO ERGO SUM