日期:2014-05-18  浏览次数:20621 次

collate Chinese_PRC_CS_AI区分大小写是针对一个条件还是针对全部条件
select * from a,b where a.name=b.name and a.desp=b.desp collate Chinese_PRC_CS_AI

这种写法,是只针对desp字段区分大小写,还是针对2个字段都区分啊?


------解决方案--------------------
当前查询的条件
------解决方案--------------------
desp
------解决方案--------------------
desp 字段
------解决方案--------------------
SQL code

create table tb(val varchar(10),vc varchar(10))
insert into tb
select 'A','a' union all
select 'b','B' union all
select 'a','A'
go

select *
from tb
where val = 'a' or vc = 'b' collate Chinese_PRC_CS_AI

/*
val        vc
---------- ----------
A          a
a          A

(2 行受影响)
*/

select *
from tb
where val = 'a' collate Chinese_PRC_CS_AI or vc = 'b' collate Chinese_PRC_CS_AI

/*
val        vc
---------- ----------
a          A

(1 行受影响)
*/

drop table tb