sql查询用逗号分隔的字符串参数,在逗号分隔的字段中查询


string str="fuhui,zhaoying";

select * from S_space where CHARINDEX(','+LTRIM(userid)+',',','+'@str'+',')>0;



逗号分隔的字符串中查询 

string str="fuhui,zhaoying";

select * from  S_space_Activity where patindex('%,str,%',','+Fans+',')>0


Fans 字段的值是已逗号分隔的 fuhui,zhaoying

你可能感兴趣的:(查询,逗号分隔参数,逗号分隔字段)