create table tb
(
id int,
name varchar(200)
)
insert tb select 1,'广东-中山'
insert tb select 2,'广东- 广州'
insert tb select 3,'广东 -深圳'
insert tb select 4,'广东-佛山' --全角下的-
insert tb select 5,'广东- 中山'
insert tb select 6,'广东 -广州'
insert tb select 7,'广东 - 深圳'select * from tb where name='广东- 广州'select * from tb where name='广东 - 深圳'drop table tb/*
id name
----------- --------------
2 广东- 广州(所影响的行数为 1 行)id name
----------- ---------
7 广东 - 深圳(所影响的行数为 1 行)
*/
(
id int,
name varchar(200)
)
insert tb select 1,'广东-中山'
insert tb select 2,'广东- 广州'
insert tb select 3,'广东 -深圳'
insert tb select 4,'广东-佛山' --全角下的-
insert tb select 5,'广东- 中山'
insert tb select 6,'广东 -广州'
insert tb select 7,'广东 - 深圳'select * from tb where name='广东- 广州'select * from tb where name='广东 - 深圳'drop table tb/*
id name
----------- --------------
2 广东- 广州(所影响的行数为 1 行)id name
----------- ---------
7 广东 - 深圳(所影响的行数为 1 行)
*/
(
id int,
name varchar(20)
)
insert tb select 1,'广东-中山'
insert tb select 2,'广东- 广州'
insert tb select 3,'广东 -深圳'
insert tb select 4,'广东-佛山' --全角下的-
insert tb select 5,'广东- 中山'
insert tb select 6,'广东 -广州'
insert tb select 7,'广东 - 深圳'select * from tb where name=' 广东- 广州'select * from tb where name='广东 - 深圳'drop table tb/*id name
----------- -------------------- (所影响的行数为 0 行)id name
----------- --------------------
7 广东 - 深圳(所影响的行数为 1 行)*/
并不是BUG,测试:
*/
declare @K table (K varchar(100))
insert @K select '杨勇-桓台'
insert @K select '杨勇-桓台'--> 中文默认排序规则不区分宽度:
select * from @K where K = '杨勇-桓台'
/*
杨勇-桓台
杨勇-桓台
*/--> 指定区分宽度查找
select * from @K where K = '杨勇-桓台' collate Chinese_PRC_CI_AS_WS
/*
杨勇-桓台
*/-------------------------------
/*
_BIN 二进制排序
_CI(CS) 是否区分大小写,CI不区分,CS区分
_AI(AS) 是否区分重音,AI不区分,AS区分
_KI(KS) 是否区分假名类型,KI不区分,KS区分
_WI(WS) 是否区分宽度WI不区分,WS区分
*/
如果你的查询对宽度敏感,把相关字段的排序规则改一下吧。
免得每次查询都要指定排序规则:
*/declare @K table (K varchar(100) collate Chinese_PRC_CI_AS_WS)
insert @K select '杨勇-桓台'
insert @K select '杨勇-桓台'select * from @K where K = '杨勇-桓台'
/*
杨勇-桓台
*/
杨勇-桓台 SQL语句不等做到准确查询???? 我快急疯了...请帮忙!
-----------
中文,英文,全角,半角的问题.