Microsoft KB Archive/189343

= FIX: ORDER BY Queries May Remove Spaces from ANSI_PADDING Tables =

Article ID: 189343

Article Last Modified on 3/14/2006

-

APPLIES TO


 * Microsoft SQL Server 6.5 Standard Edition

-



This article was previously published under Q189343



BUG #: 18018 (SQLBUG_65)



SYMPTOMS
An ORDER BY query can remove any trailing spaces if all of the following conditions are true:
 * The table is created while ANSI_PADDING is enabled.
 * Some of the rows contain trailing spaces in columns of type varchar.
 * The ORDER BY query is executed with ANSI_PADDING disabled.
 * A worktable is used for an ORDER BY clause.
 * The entire column list is not selected with "*".



WORKAROUND
To work around this problem, try one of the following:
 * Enable ANSI_PADDING before running the query.
 * Create an index on the table that can be used for the ORDER BY clause.
 * Select all columns of the table with "*".



STATUS
Microsoft has confirmed this to be a problem in SQL Server 6.5. This problem has been corrected in Service Pack 5a for Microsoft SQL Server 6.5.For more information, click the following article number to view the article in the Microsoft Knowledge Base:

197177 INF: How to Obtain SQL Server 6.5 Service Pack 5a

For more information, contact your primary support provider.



MORE INFORMATION
DB-Library clients are susceptible to this problem, because ANSI_PADDING is disabled by default. ODBC-based clients would not normally see this problem because ANSI_PADDING is enabled by default.

Additional query words: sp sp5sort truncate truncated work table

Keywords: kbbug kbfix KB189343

-

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

© Microsoft Corporation. All rights reserved.