Article ID: 189343 - Last Review: March 14, 2006 - Revision: 4.0

FIX: ORDER BY Queries May Remove Spaces from ANSI_PADDING Tables

This article was previously published under Q189343
BUG #: 18018 (SQLBUG_65)
Expand all | Collapse all

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  (http://support.microsoft.com/kb/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.

APPLIES TO
  • Microsoft SQL Server 6.5 Standard Edition
Keywords: 
kbbug kbfix KB189343
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
 

Article Translations