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