[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2007-07-26
3
Medium Priority
?
1,748 Views
Last Modified: 2008-07-31
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
Comment
Question by:mrsvert
3 Comments
 
LVL 15

Expert Comment

by:derekkromm
ID: 19574099
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
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 19574120
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
 

Author Comment

by:mrsvert
ID: 19574165
Thanks so much and really quick response!!!!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how the fundamental information of how to create a table.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question