FIX: DBCS Space Is Not Treated Correctly
This article was previously published under Q258226
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 56969 (SQLBUG_70)
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.
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.
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.0For more information, contact your primary support provider.
Steps to Reproduce the ProblemThe following script reproduces this problem:
-- Create tables & insert rows.create table t1(c1 varchar(5))create table t2(c1 varchar(5))goinsert into t1 values(0x8140) -- DBCS spaceinsert into t2 values(0x20) -- 1 byte spacego--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 spaceselect convert(binary,c1) from t1 where c1 = 0x20 -- 1 byte spaceselect convert(binary,c1) from t2 where c1 = 0x8140 -- DBCS spaceselect convert(binary,c1) from t2 where c1 = 0x20 -- 1 byte spacego-- 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.c1go
Article ID: 258226 - Last Review: 11/02/2013 00:15:00 - Revision: 3.0
Microsoft SQL Server 7.0 Standard Edition
- kbnosurvey kbarchive kbbug kbcodesnippet kbfix KB258226