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

ID: Q155893


The information in this article applies to:


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          : SSrvErr_Log kbbug6.50 kbbug6.00 
Version           : 6.0 6.5
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: April 2, 1999