Assume there is a table named ‘myTable’ with three columns:
{**ID**(PK, int, not null), **X**(PK, int, not null), **Name**(nvarchar(256), not null)}.
Let {4, 1, аккаунт} be a record on the table.
select * from myTable as t where t.ID=4 AND t.X = 1 AND ( t.Name = N'аккаунт' ) select * from myTable as t where t.ID=4 AND t.X = 1 AND ( t.Name LIKE N'%аккаунт%' )
The first query return the record, however, the second does not? Why?
Systems where this issues are experienced:
*Windows XP – Professional – Version 2002 – SP3
Server Collation: Latin1_General_CI_AS
Version: 9.00.3073.00
Level: SP2
Edition: Developer Edition
Sever Collation: SQL_Latin1_General_CP1_CI_AS
Version: 9.00.3054.00
Level: SP2
Edition: Enterprise Edition
Results:
SELECT SERVERPROPERTY('SQLCharSetName') iso_1 Using OSQL.exe 0x30043A043A04300443043D04420400000000000000000000000000000000 0x3F3F3F3F3F3F3F0000000000000000000000000000000000000000000000 0x253F3F3F3F3F3F3F25000000000000000000000000000000000000000000 SELECT CAST(name AS BINARY), CAST(N'аккаунт' AS BINARY), CAST(N'%аккаунт%' AS BINARY) FROM myTable t WHERE t.ID = 4 AND t.X = 1 CAST(name AS BINARY) 0x30043A043A04300443043D04420400000000000000000000000000000000 CAST(N'аккаунт' AS BINARY) 0x3F3F3F3F3F3F3F0000000000000000000000000000000000000000000000 CAST(N'%аккаунт%' AS BINARY) 0x253F3F3F3F3F3F3F25000000000000000000000000000000000000000000
Alright, after a great deal of research, I found it is indeed a problem found on the following versions of SQL Server 2005:
Windows XP – Professional – Version 2002 – SP3
Version: 9.00.3073.00
Level: SP2
Edition: Developer Edition
Version: 9.00.3054.00
Level: SP2
Edition: Enterprise Edition
..may be other versions as well.
FIX: Upgrade to SP3.