BUG: Alias with Same Name as Keyword in SELECT Causes Error

ID: Q118489

The information in this article applies to:

SYMPTOMS

If a table has the same name as any of the keywords in a SELECT-SQL command (for example, NOCONSOLE, PLAIN, UNION, or GROUP) and the table's alias is referenced as the first field in the list of fields in a SELECT-SQL command, a "Syntax Error" message will occur.

RESOLUTION

To avoid this problem, do one of the following:

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 the Problem

Issue the following commands from the Command window:

   CREATE TABLE union (name C(10), age N(5))
   APPEND BLANK
   SELECT union.name FROM union

This will produce the error message mentioned above.

To avoid this error, issue the following command:

   SELECT age, union.name FROM union

This command does not produce the error because the field that references the table is not first in the list of fields.

This behavior is similar to that described in article Q112308, which describes a problem that occurs only in FoxPro version 2.0. In FoxPro version 2.0, the error occurs when you use a keyword anywhere in the SELECT command as a table name.

For more information about this problem, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q112308
   TITLE     : PRB: Reserved Words Invalid Table Names in FoxPro 2.0 SELECT

Additional reference words: FoxMac FoxDos FoxWin 2.00 2.50 2.50a 2.50b 2.60 buglist2.00 buglist2.50 buglist2.50a buglist2.50b buglist2.60 key word database KBCategory: kbprg kberrmsg kbbuglist KBSubcategory: FxprgSql

Last Reviewed: June 27, 1995