BUG: SQL Internal Error Returned When UDF Value Is Null

Last reviewed: June 27, 1995
Article ID: Q124585
The information in this article applies to:
  • Microsoft FoxPro for Windows, version 2.6a
  • Microsoft FoxPro for MS-DOS, version 2.6a
  • Microsoft FoxPro for Macintosh, version 2.6a

SYMPTOMS

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.

RESOLUTION

To work around the problem:

  • Change the GROUP BY a field name instead of 1:

    SELECT Myudf(Name) ;

          FROM Test ;
          GROUP BY Name
    

    -or-

  • Return a space instead of a null from the UDF:

    RETURN IIF(Getname = "Sam", Getname," ")

STATUS

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.

MORE INFORMATION

Steps to Reproduce Problem

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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.