--该问题问过好多次了。declare @t table(id int, a1 varchar(20))
insert into @t select 1,'_38_55_456_'
union all select 2,'_22_45_99_'
union all select 3,'_57_8_'
select * from @t where charindex('_8_',a1)>0
/*
id a1
----------- --------------------
3 _57_8_(1 行受影响)
*/
insert into @t select 1,'_38_55_456_'
union all select 2,'_22_45_99_'
union all select 3,'_57_8_'
select * from @t where charindex('_8_',a1)>0
/*
id a1
----------- --------------------
3 _57_8_(1 行受影响)
*/
Insert b1 Select 1,'_38_55_456_'
Union All Select 2,'_22_45_99_'
Union All Select 3,'_57_8_'
GO
select * from b1 Where a1 like '%[_]8[_]%'
GO
Drop table b1
--Result
/*
ID a1
3 _57_8_
*/
insert @tab values(2,'_22_45_99_')
insert @tab values(3,'_57_8_')select * from @tab where a1 like '%_8_%'--这个你想要的
select * from @tab where charindex('_8_',a1,0)>0
select * from a1 where patindex('%_8_%',a1)>0