ALTER FUNCTION [dbo].[customers_udfMin2]
(
@decission tinyint
)
RETURNS int
AS
BEGIN
-- Declare the return variable here
DECLARE @min int
Declare @default int = 10
-- Add the T-SQL statements to compute the return value here
if (@decission = 1)
Begin
SELECT @min = MIN(customers.cus_id) from customers
End
else
RETURN 0
Return @default
END
in every case it returns @default , y ? even i sent 1 as a parameter.