BUG: ANSI Group By With > 16 Columns Gives Inconsistent Error

Last reviewed: April 9, 1997
Article ID: Q155893

The information in this article applies to:
  • Microsoft SQL Server, versions 6.0 and 6.5

SYMPTOMS

A Group By clause with more than 16 non-aggregate columns can cause 2 different errors depending on the number of columns. If there are 17 non- aggregate columns, the following error will be returned:

   Msg 415, Level 16, State 1
   The current query would require an index on a work table to be built
   with 15 keys. The maximum allowable number of keys is 16.

If there are more than 17 non-aggregate columns the following error will be returned:

   Msg 253, Level 16, State 1
   Maximum number of group-by expressions exceeded (16 max, 17 found).

WORKAROUND

  1. Rewrite query such that no more than 16 columns appear in the Group By clause.
2. Use trace flag 204.

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.0 and 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The 415 error message reports the number of key columns incorrectly as 15.

The 253 error message always reports that 17 non-aggregate columns were found no matter how many there actually are in the Group By clause.


Additional query words: aggregate
Keywords : kbbug6.00 kbbug6.50 SSrvErr_Log
Version : 6.0 6.5
Platform : WINDOWS
Issue type : kberrmsg


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: April 9, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.