微软BI开拓者数据库专区SQL Server开发 求助:排序规则与LIKE的一个实例

1  /  1  页   1 跳转 查看:5153

[技术文档] 求助:排序规则与LIKE的一个实例

求助:排序规则与LIKE的一个实例

--数据库排序规则为Chinese_PRC_CI_AS
select name,collation_name from sys.databases
GO

if OBJECT_ID('test') is not null
drop table test
GO

create table test
(
a varchar(40)
)
GO

insert into test
select '123A90' union all
select '123a90' union all
select '123B90' union all
select '123C90' union all
select '123c90'

select * from test

select *
from test
where a like '%[ABC]%'
collate Chinese_PRC_CS_AS

a
-------------
123A90
123B90
123C90

select *
from test
where a like '%[A-C]%'
collate Chinese_PRC_CS_AS

a
------------------
123A90
123B90
123C90
123c90
 

回复:求助:排序规则与LIKE的一个实例

select *
from test
where a like '%[A-C]%'
collate Chinese_PRC_BIN
 

回复:求助:排序规则与LIKE的一个实例

虽然这样可以了,但我还不明白,为什么
where a like '%[A-C]%'
collate Chinese_PRC_CS_AS
不行
 
1  /  1  页   1 跳转

版权所有 微软BI开拓者 

Powered by Discuz!NT 2.1.202    Copyright © 2001-2012 Comsenz Inc.
Processed in 0.0468768 second(s) , 3 queries.
返顶部