FIX: DBCS Space Is Not Treated Correctly

Article translations Article translations
Article ID: 258226 - View products that this article applies to.
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)
Expand all | Collapse all

On This Page

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.

More information

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
				

Properties

Article ID: 258226 - Last Review: November 2, 2013 - Revision: 3.0
Applies to
  • Microsoft SQL Server 7.0 Standard Edition
Keywords: 
kbnosurvey kbarchive kbbug kbcodesnippet kbfix KB258226

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com