ALTER FUNCTION [dbo].[ufEmployeeHrs](@Id int,@DateWorked date)
RETURNS decimal(4,2)
AS
BEGIN
DECLARE @DateName = (SELECT DATENAME(weekday,@DateWorked))
case @DateName = 'monday'
Return (select Mon_hrs
from workhrs
where recordid = :ar_recordid ;
case 'tuesday'
Return (select tue_hrs
from workhrs
where recordid = :ar_recordid ;
RETURN @ret;
END;
...
Go to the complete details ...