假设有一个名为“myTable”的表,包含三列:
{**ID**(PK, int, not null),
**X**(PK, int, not null),
**Name**(nvarchar(256), not null)}.
让 {4, 1, аккаунт} 成为桌子上的记录。
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'%аккаунт%' )
第一个查询返回记录,但是,第二个没有?为什么?
遇到此问题的系统:
*Windows XP - Professional - 版本 2002 - SP3
服务器排序规则: Latin1_General_CI_AS
版本: 9.00.3073.00
级别: SP2
版本:开发人员版
服务器排序: SQL_Latin1_General_CP1_CI_AS
版本: 9.00.3054.00
级别: SP2
版本:企业版
结果:
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