• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1757
  • Last Modified:

SQL Error "[functionname] is not a recognized function name"

I created a function to get an effectivedate
ALTER   FUNCTION fDW_GetEffectiveDate (@TodaysDate datetime)
RETURNS DATETIME
AS
BEGIN
      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'
      RETURN @EffectiveDate
END

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,
FROM [TABLENAME]

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?
HELP!
Thanks!
0
mrsvert
Asked:
mrsvert
1 Solution
 
derekkrommCommented:
1) Make sure you have proper permission/access to the function with the account that is running the query

2) Make sure the function is in the same database you are running the query from
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
when using functions; you HAVE to use the function owner name also:

SELECT STUFF, MORESTUFF, ETCSTUFF,
dbo.fDW_GetEffectiveDate(@TodaysDate) AS EffectiveDate,
FROM [TABLENAME]
0
 
mrsvertAuthor Commented:
Thanks so much and really quick response!!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now