FIX: SELECT with ORDER BY on an Oversized Table Fails

Last reviewed: October 24, 1997
Article ID: Q175659
The information in this article applies to:
  • Microsoft SQL Server version 6.5
BUG #: 16074 (WINDOWS: 6.5)

SYMPTOMS

If you create an "oversized" table (that is, a table with a width greater than 1,962 bytes), you will receive the following message:

   The total row size, 2575, for table 't1' exceeds the maximum number of
   bytes per row, 1962.

If this table does not have an index and you execute a query with an ORDER BY clause (such as "SELECT * from t1 ORDER BY c1"), you will receive the following message:

   Msg 416, Level 16 State 1
   Create of work table failed because the row size would be 2575.
   This exceeds the maximum allowable size of a row in a table, 2014.

WORKAROUND

To avoid this problem, use a statement similar to the following to create an index on the table:

   create index ti on t1(c1)

STATUS

Microsoft has confirmed this to be a problem in SQL Server version 6.5. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server version 6.5. For more information, contact your primary support provider.

MORE INFORMATION

The following statements will reproduce the problem:

   create table t1
   (c1 varchar(255) not null,
    c2 varchar(255) not null,
    c3 varchar(255) not null,
    c4 varchar(255) not null,
    c5 varchar(255) not null,
    c6 varchar(255) not null,
    c7 varchar(255) not null,
    c8 varchar(255) not null,
    c9 varchar(255) not null,
    c10 varchar(255) not null)
   go
   insert t1 values("A","Z","Z","Z","Z","Z","Z","Z","Z","Z")
   insert t1 values("B","Z","Z","Z","Z","Z","Z","Z","Z","Z")
   insert t1 values("C","Z","Z","Z","Z","Z","Z","Z","Z","Z")
   insert t1 values("D","Z","Z","Z","Z","Z","Z","Z","Z","Z")
   insert t1 values("E","Z","Z","Z","Z","Z","Z","Z","Z","Z")
   insert t1 values("F","Z","Z","Z","Z","Z","Z","Z","Z","Z")
   insert t1 values("G","Z","Z","Z","Z","Z","Z","Z","Z","Z")
   insert t1 values("H","Z","Z","Z","Z","Z","Z","Z","Z","Z")
   insert t1 values("I","Z","Z","Z","Z","Z","Z","Z","Z","Z")
   insert t1 values("J","Z","Z","Z","Z","Z","Z","Z","Z","Z")
   go


Additional query words: sp sp2
Keywords : kbbug6.50 kbfix6.50.sp2 SSrvGen SSrvTran_SQL kbusage
Version : WINNT:6.5
Platform : winnt
Issue type : kbbug
Solution Type : kbfix


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