22,209
社区成员
发帖
与我相关
我的任务
分享
create table #tb(col nvarchar(20))
insert into #tb
select '-AM001'
union all select '-AM020'
union all select '-AM030'
union all select '-ZM200'
union all select '-ZM300'
union all select 'AM100'
union all select 'AM101'
union all select 'ZM100'
union all select 'ZM200'
union all select 'ZM201'
SELECT *
FROM #tb
WHERE col between '-AM001' and '-ZM200' collate Chinese_PRC_BIN
create table #tb(col nvarchar(20))
insert into #tb
select '-AM001'
union all select '-AM020'
union all select '-AM030'
union all select '-ZM200'
union all select '-ZM300'
union all select 'AM100'
union all select 'AM101'
union all select 'ZM100'
union all select 'ZM200'
union all select 'ZM201'
select * from #tb
where col like '-%' and col between '-AM001' and '-ZM200'
/*
-AM001
-AM020
-AM030
-ZM200
*/