日期:2014-05-18 浏览次数:20469 次
charindex('1,2,4',字段)>0来判断 return 0 else return 1
------解决方案--------------------
create table t1(id int) insert into t1 select 1 union all select 2 union all select 4 go --都在 if exists (select 1 from t1 where charindex(','+ltrim(id)+',',','+'1,2,4'+',') = 0) print 0 else print 1 --某个不在 if exists (select 1 from t1 where charindex(','+ltrim(id)+',',','+'1,2,3'+',') = 0) print 0 else print 1 drop table t1 /******************* 1 0