Microsoft KB Archive/155893

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

Article ID: 155893

Article Last Modified on 10/16/2003

-

APPLIES TO


 * Microsoft SQL Server 6.0 Standard Edition
 * Microsoft SQL Server 6.5 Standard Edition

-



This article was previously published under Q155893





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: kbbug KB155893

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.