declare @a xml
set @a=' 1 5 4 3 2' select * from product where id in (
select d.x.value('./id[1]','int') from @a.nodes('/*') as d(x))
1:如果参数是varchar类型:
代码如下
复制代码
declare @a xml
set @a=' a b5 c4 d3 e2'
select * from product where pname in (
select d.x.value('./name[1]','varchar(100)') from @a.nodes('/*') as d(x))