create Procedure [dbo].[Test]
@xml varchar(8000)
as
begin
declare @doc xml
set @doc=@xml
set @doc.modify('delete /biglottos/N1') -- 测试节点删除。
select convert(varchar(200), @Doc)
SELECT
A.x.query('N1').value('.','int')N1 ,
A.x.query('N2').value('.','int')N2 ,
A.x.query('N3').value('.','int')N3
FROM @doc.nodes('/biglottos') AS A(x)
end
declare @aa nvarchar(4000)
SET @aa='<biglottos> <N1>1 </N1> <N2>2 </N2> <N3>4 </N3> </biglottos>'
exec Test @aa在存储过程中,用xml作为参数传递
最新推荐文章于 2021-02-27 18:04:01 发布
本文详细介绍了如何使用SQL Server的XML类型进行节点删除及查询操作,通过示例代码展示了节点删除过程,并提供了节点查询的具体实现。
670

被折叠的 条评论
为什么被折叠?



