怎么实现sqlserver中:select * from A a where a.oid in(str[]);
怎样从一个数组中查询出符合要求的数据??这个str[]数组很大
数据库的字段中是怎么存放一个数组的呢?
select * from A a where a.oid in(str[]);
------解决方案--------------------declare @t table(id int,name varchar(1000))
insert @t select 1, '33,76,32,12 '
union all select 2, '3,32,55,87 '
union all select 3, '54,5,3,67 '
declare @str varchar(100)
set @str= '5 '
select * from @t where charindex( ', '+@str+ ', ', ', '+name+ ', ')> 0