SQL Error "[functionname] is not a recognized function name"
I created a function to get an effectivedate
ALTER FUNCTION fDW_GetEffectiveDate (@TodaysDate datetime)
DECLARE @EffectiveDate DATETIME
IF @TodaysDate BETWEEN '08/07/2006' AND '08/19/2007'
SET @EffectiveDate = '05/25/2007'
ELSE IF @TodaysDate BETWEEN '08/01/2005' AND '08/01/2006'
SET @EffectiveDate = '05/25/2006'
Then I am trying to call it in a select statement to set the effectivedate for the row.
SELECT STUFF, MORESTUFF, ETCSTUFF,
fDW_GetEffectiveDate(@TodaysDate) AS EffectiveDate,
But it is giving me the error "fDW_GetEffectiveDate is not a recognized function name."
Am I possibly typing something wrong or am I doing it wrong altogether?