select * from tbl where charindex('SD',col)>0 and charindex('MSD',col)=0
--这样? declare @t table([string] varchar(10)) insert into @t select 'MSD' insert into @t select 'SD1' insert into @t select 'S31D1' insert into @t select 'MSD31' insert into @t select 'SD31'select * from @t where charindex('SD',[string])>0 and charindex('MSD',[string])=0
select * from t where charindex('SD',col) > 0 and charindex('MSD',col) = 0
where charindex('SD',col)>0 and charindex('MSD',col)=0
declare @t table([string] varchar(10))
insert into @t select 'MSD'
insert into @t select 'SD1'
insert into @t select 'S31D1'
insert into @t select 'MSD31'
insert into @t select 'SD31'select * from @t where charindex('SD',[string])>0 and charindex('MSD',[string])=0
where charindex('SD',col) > 0
and charindex('MSD',col) = 0