I'm about to implement this function to calculate some numbers.
CREATE FUNCTION [dbo].[funLookupFTE] (@PFID int) RETURNS
VARCHAR(20) AS BEGIN
DECLARE @NumberOfFTE AS VARCHAR(20)
SET @NumberOfFTE = (SELECT SUM(CASE WHEN Hours <= 20 THEN 0.5 WHEN Hours > 20 THEN 1 END) AS FTECount
FROM tblPractitioners
WHERE PFID =
@PFID)
RETURN @NumberOfFTE
END
Just trying to see if it's optimal and it won't take matters into its own hand.
Thanks