34,575
社区成员
发帖
与我相关
我的任务
分享
create table tb(A nvarchar(30))
insert into tb select '张三,李四,王五'
insert into tb select '大张三,李四二,王五六,赵六'
insert into tb select '张三附,包李四,五六'
go
select * from tb where ','+A+',' like '%,张三,%'
select * from tb where charindex(',张三,',','+A+',')>0
/*
A
------------------------------
张三,李四,王五
(1 行受影响)
A
------------------------------
张三,李四,王五
(1 行受影响)
*/
go
drop table tb
select * from tb where charindex(',张三,',','+A+',')>0
select * from tb where ','+A+',' like '%,张三,%'