i need to create a function that gets 2 parameters an id of a customer and a price i have to calculate the age of the customer and depending on his age i have to calculate a discount on the price
so for the function i tried
CREATE FUNCTION DISCOUNT(@ID INT,@PRICE INT) RETURNS TABLE RETURN SELECT BIRTHDATE FROM CUSTOMER WHERE BIRTHDATE > '10-14-1955' SET @price = @price - 10
The problem is that i need to return a scalar value instead of a table but i don't know how to access the birthdate colomn within a scalar function
is there someone who can help me? thanks