ID: Q124585
The information in this article applies to:
When an SQL SELECT statement calls a UDF that returns a null value, a SQL Internal Error occurs if the SELECT statement has a GROUP BY 1 clause.
To work around the problem:
SELECT Myudf(Name) ;
FROM Test ;
GROUP BY Name
-or-
RETURN IIF(Getname = "Sam", Getname," ")
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
Build a database and run a SELECT statement. Type the following code into a program and run that program:
CREATE TABLE Test (Name C(15))
INSERT INTO Test (Name) VALUES ("Robert")
INSERT INTO Test (Name) VALUES ("Sam")
INSERT INTO Test (Name) VALUES ("James")
SELECT Myudf(Name) ;
FROM Test ;
GROUP BY 1
FUNCTION Myudf
PARAMETER Getname
RETURN IIF(Getname = "Sam", Getname,"")
Additional reference words: FoxWin FoxDos FoxMac 2.60a buglist2.60a
KBCategory: kbprg kbbuglist
KBSubcategory: FxprgSql
Last Reviewed: June 27, 1995