日期:2014-05-18 浏览次数:21765 次
create table table1(bbb int) insert into table1 values(2) insert into table1 values(3) insert into table1 values(5) insert into table1 values(1) go declare @arr varchar(10) set @arr='3,5' select * from table1 where charindex(','+cast(bbb as varchar) + ',' , ',' + @arr + ',') = 0 /* bbb ----------- 2 1 (所影响的行数为 2 行) */ select * from table1 where ',' + @arr + ',' not like '%,'+cast(bbb as varchar) + ',%' /* bbb ----------- 2 1 (所影响的行数为 2 行) */ drop table table1