[英]SQL Server Query Unicode String
I have a table UserType
: 我有一个表
UserType
:
id (int),
type nvarchar(50)
I have inserted some rows into that table 我已在该表中插入了一些行
INSERT INTO [UserType] VALUES (N'កក្កដា');
INSERT INTO [UserType] VALUES (N'វិច្ឆិកា');
And it's successfully inserted. 并且已成功插入。
Then when I tried to query it back 然后当我试图查询回来
select *
from [UserType]
where type=N'កក្កដា';
It returns all rows. 它返回所有行。
What's wrong? 怎么了? Please help!
请帮忙!
Looks like you database is Accent Insensitive
. 看起来您的数据库对
Accent Insensitive
。
You need to explicitly
mention the proper collation
name in where
clause to filter the proper data. 您需要在
where
子句中explicitly
提及适当的collation
名称,以过滤适当的数据。
Use Latin1_General_100_CI_AS
collation which is accent sensitive
. 使用
accent sensitive
Latin1_General_100_CI_AS
归类。 Try this. 尝试这个。
SELECT *
FROM [UserType]
WHERE type = CONVERT(NVARCHAR(50), N'វិច្ឆិកា') COLLATE Latin1_General_100_CI_AS;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.