Cannot sort a row of size 10231

  • When am selecting a no of records by order by clause iam getting the following error

    Error Type:

    Microsoft OLE DB Provider for SQL Server (0x80040E14)

    Cannot sort a row of size 10231, which is greater than the allowable maximum of 8094.

    What should i do now?

  • Hi there

    Well, this is a funny one, ive seen the same error hex code but a different message:

    Microsoft OLE DB Provider for SQL Server (0x80040E14)

    The text, ntext, and image data types cannot be used in an

    ORDER BY clause.

    Is this the case for you? try:

    order by convert(varchar, mytextcolumn)

    -- or this --

    order by (cast(yourfield) as varchar(8000))

    take a close look at your esult set though and its sort/group-by order.

    Cheers

    Ck

    Chris Kempster

    http://www.chriskempster.com

    Author of "SQL Server 2k for the Oracle DBA"


    Chris Kempster
    www.chriskempster.com
    Author of "SQL Server Backup, Recovery & Troubleshooting"
    Author of "SQL Server 2k for the Oracle DBA"

  • ORDER BY actually performs this in the tempDB database by creating a table and thus you are limited to the 8k with for the data. You might first get rid of any unneeded data in your query (especially if using SELECT *) or trying the order on the bit of data that you order by in a subquery and join to that (this will usually work but may not so test it).

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply