Microsoft KB Archive/258226

= FIX: DBCS Space Is Not Treated Correctly =

Article ID: 258226

Article Last Modified on 3/14/2006

-

APPLIES TO


 * Microsoft SQL Server 7.0 Standard Edition

-



This article was previously published under Q258226



BUG #: 56969 (SQLBUG_70)



SYMPTOMS
SQL Server 7.0 Books Online states that a double-byte character set (DBCS) space is equal to a normal (1-byte) space. However, SQL Server cannot treat these DBCS spaces equally when it compares a DBCS space with a normal space by using column names that contain them in a WHERE clause.



WORKAROUND
To work around this problem, create an index on the columns that contain DBCS space or normal (1 byte) space values. If indexes exist on columns that contain DBCS space or normal (1 byte) space values, this problem does not occur.



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

254561 INF: How to Obtain Service Pack 2 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0

For more information, contact your primary support provider.



Steps to Reproduce the Problem
The following script reproduces this problem: -- Create tables & insert rows. create table t1(c1 varchar(5)) create table t2(c1 varchar(5)) go insert into t1 values(0x8140) -- DBCS space insert into t2 values(0x20)  -- 1 byte space go --Examine the contents of tables. select convert(binary,c1) from t1 -- c1 in t1 has 0x8140 (DBCS space) select convert(binary,c1) from t2 -- c1 in t2 has 0x20 (1 byte space) go -- We can receive the correct results through the following queries. -- Each query returns 1 row. select convert(binary,c1) from t1 where c1 = 0x8140 -- DBCS space select convert(binary,c1) from t1 where c1 = 0x20  -- 1 byte space select convert(binary,c1) from t2 where c1 = 0x8140 -- DBCS space select convert(binary,c1) from t2 where c1 = 0x20  -- 1 byte space go -- But we can not receive the correct result from following query, -- if we compare them using their column names. As a result, we should have -- 1 row, but 0 row returns from SQL Server. select convert(binary,t1.c1),convert(binary,t2.c1) from t1,t2 where t1.c1 = t2.c1 go

Keywords: kbbug kbfix kbcodesnippet KB258226

-

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

© Microsoft Corporation. All rights reserved.