This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 363394 (SHILOH_BUGS)
A query may return incorrect results if all the following conditions are true:
The query contains a LIKE predicate.
Binary collation is used.
The last character in the LIKE predicate ends with 0xFF in Unicode. For example, 0x66FF (U-66FF), and that character is not the first character.
There are no wildcard characters before the character that ends with 0xFF in the LIKE predicate.
An Index seek is chosen for the LIKE predicate.
Unicode comparison (Unicode pattern matching) is performed for the LIKE predicate.
The following sample queries meet the conditions listed earlier in this article:
-- Each question mark ("?") in the queries represent a character that ends with 0xFF.-- Default collation of the current database is Japanese_Bin (binary collation).-- Collation of column c1 is also Japanese_Bin (the same collation as the current database).-- Column c1 is defined as anvarchar data type (Unicode data type).-- Index is on column c1. SELECT * FROM t1 WHERE c1 LIKE N'A?' SELECT * FROM t1 WHERE c1 LIKE 'A?' SELECT * FROM t1 WHERE c1 LIKE N'ABC?%' -- ? is the last character, % is wildcard character
To work around this behavior, use an (INDEX=0) hint.
Service pack information
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 How to obtain the latest SQL Server 2000 service pack
The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
Date Time Version Size File name Description --------------------------------------------------------------------------------- 11-Dec-2002 19:42 2000.80.715.0 7,467,089 bytes Sqlservr.exe SP2-based fix
NOTE: Because of file dependencies, the most recent hotfix or feature that contains the files may also contain additional files.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.This problem was first corrected in Microsoft SQL Server 2000 Service Pack 4.
The LIKE predicate supports ASCII pattern matching and Unicode pattern matching. When all arguments (match_expression, pattern, and escape_character, if present) are ASCII character data types, ASCII pattern matching is performed. If any of the arguments are Unicode data type, all the arguments are converted to Unicode and Unicode pattern matching is performed. Depending on the data types of the column and character in the LIKE predicate, data type conversion is also performed.
SQL Server Books Online; topic: "Data Type Precedence"