存储过程
create procedure test
{
@tex varchar(1000)
}select * from tab where id= ????
传近来@tex ='1,3,9,11'
搜索出id =1 ,id=3,id=9,id =11 的记录 id是int
create procedure test
{
@tex varchar(1000)
}select * from tab where id= ????
传近来@tex ='1,3,9,11'
搜索出id =1 ,id=3,id=9,id =11 的记录 id是int
@tex varchar(1000)
as
exec('select * from tab where id in('+@tex+')')
go
select *
from tab
where charindex(','+cast(id as varchar)+',' , ','+@tex+',')>0