Microsoft KB Archive/321271

= FIX: Unicode Pattern Matching Returns Incorrect Results =

Article ID: 321271

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft SQL Server 2000 Service Pack 2

-



This article was previously published under Q321271



BUG #: 357081 (SHILOH_BUGS)



SYMPTOMS
If you use a Binary sort order, such as Japanese_Bin, Unicode pattern matching with the LIKE operator may return incorrect results.

This problem may occur if the pattern matching character includes the double-byte character set (DBCS). This is a regression bug that started with SQL Server 2000 Service Pack 2.

For more details and a sample query that reproduces this behavior, see the &quot;More Information&quot; section of this article.



RESOLUTION
To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

290211 INF: How To Obtain the Latest SQL Server 2000 Service Pack

NOTE: The following hotfix was created before the release of Microsoft SQL Server 2000 Service Pack 3.

The English version of this fix should have the following file attributes or later:   Date         Time    Version    Size      File name ---

04/11/2002  06:58   8.00.608   7168 KB   Sqlservr.exe NOTE: Because of file dependencies, the most recent hotfix or feature that contains the files may also contain additional files.



WORKAROUND
To work around this problem, use a different collation other than Binary sort order.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

This problem was first corrected in Microsoft SQL Server 2000 Service Pack 3.



MORE INFORMATION
To reproduce the problem, use the following script:

create table t1(c1 nvarchar(10) collate Japanese_bin) go insert t1 values(convert(nvarchar, 0xA230)) insert t1 values(convert(nvarchar, 0xAB30)) insert t1 values(convert(nvarchar, 0xB530)) insert t1 values(convert(nvarchar, 0xBF30)) insert t1 values(convert(nvarchar, 0xCA30)) insert t1 values(convert(nvarchar, 0xAB30A430)) insert t1 values(convert(nvarchar, 0xBF30CA30AB30)) insert t1 values(convert(nvarchar, 0xBF30CA30AB30)) insert t1 values(convert(nvarchar, 0xE430DE30C030)) insert t1 values(convert(nvarchar, 0xBF30AB30CA30)) insert t1 values(convert(nvarchar, 0xB530)) go select convert(binary, c1) from t1 where c1 like convert(nvarchar, 0xB530) go The script returns this result:

-- 0xAB3000000000000000000000000000000000000000000000000000000000 0xB53000000000000000000000000000000000000000000000000000000000 0xBF3000000000000000000000000000000000000000000000000000000000 0xCA3000000000000000000000000000000000000000000000000000000000 0xB53000000000000000000000000000000000000000000000000000000000 The SELECT statement should return this result: -- 0xB53000000000000000000000000000000000000000000000000000000000 0xB53000000000000000000000000000000000000000000000000000000000

Additional query words: unicode like

Keywords: kbbug kbfix kbsqlserv2000presp3fix kbsqlserv2000sp3fix KB321271

-

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

© Microsoft Corporation. All rights reserved.