没问题 select * from tabA where CHARINDEX(',A,',','+colA+',')>0
我這樣試了一下: DECLARE @varNotation varchar(60) set @varNotation='D' + ',' +'B' select @varNotation select '1' where '%D%' like ( @varNotation) 發現還沒有達到預期效果
DECLARE @varNotation varchar(60) set @varNotation='D' + ',' +'B' select @varNotation select '1' where @varNotation like '%D%'
select 'a' where 'd' in (left(@a,1),right(@a,1))
DECLARE @varNotation varchar(60) set @varNotation='D' + ',' +'B' select @varNotation select '1' where @varNotation like '%D%'
如果要消除 D 与 DD 的Bug必须用DECLARE @varNotation varchar(60) set @varNotation='DD' + ',' +'B' select @varNotation select '1' where ','+@varNotation+',' like '%,D,%'
如果要消除 D 与 DD 的Bug必须用DECLARE @varNotation varchar(60) set @varNotation='DD' + ',' +'B' select @varNotation select '1' where ','+@varNotation+',' like '%,D,%'
1。 select * from tabA where CHARINDEX('A',colA)>0 2。 select * from tabA where colA like '%A%'
1。 select * from tabA where CHARINDEX('A',colA)>0 2。 select * from tabA where colA like '%A%'
select * from tabA where CHARINDEX(',A,',','+colA+',')>0
DECLARE @varNotation varchar(60)
set @varNotation='D' + ',' +'B'
select @varNotation
select '1' where '%D%' like ( @varNotation) 發現還沒有達到預期效果
set @varNotation='D' + ',' +'B'
select @varNotation
select '1' where @varNotation like '%D%'
set @varNotation='D' + ',' +'B'
select @varNotation
select '1' where @varNotation like '%D%'
set @varNotation='DD' + ',' +'B'
select @varNotation
select '1' where ','+@varNotation+',' like '%,D,%'
set @varNotation='DD' + ',' +'B'
select @varNotation
select '1' where ','+@varNotation+',' like '%,D,%'
select * from tabA where CHARINDEX('A',colA)>0
2。
select * from tabA where colA like '%A%'
select * from tabA where CHARINDEX('A',colA)>0
2。
select * from tabA where colA like '%A%'