日期:2014-05-17 浏览次数:20671 次
declare @tab table(ptext varchar(10) collate Chinese_PRC_BIN)
insert into @tab
select '-AM001' union
select '-AM020' union
select '-AM030' union
select '-ZM200' union
select '-ZM300' union
select 'AM100' union
select 'AM101' union
select 'ZM100' union
select 'ZM200' union
select 'ZM201'
select * from @tab where ptext>='-AM001' and ptext<='-ZM200'
--不用去修改表中字段的排序规则
--而是直接在查询中修改排序规则为 二进制排序,这种方式比较灵活
SELECT * FROM Test
WHERE Ptxt >= '-AM001' collate Chinese_PRC_BIN
AND Ptxt <= '-ZM200' collate Chinese_PRC_BIN