SQL Server OpenXML TIPS

zhaozj2021-02-16  66

Use OpenXML to Operate The XML Document with Namespace

- Example OneDeclare @xml nvarchar (1000) set @xml = '

TEST1

TEST2

'Declare @doc int exec sp_xml_preparedocument @doc output, @XML,' 'Select * from OpenXML (@doc,' / whox: head / whox: test ', 2) with (D nvarchar (50)' text () ') EXEC SP_XML_REMOVEDOCUMENT @doc - Example Twodeclare @Xml nvarchar (1000) set @xml = '

TEST1

TEST2

'Declare @doc int exec sp_xml_preparedocument @doc output, @XML,' 'Select * from OpenXML (@doc,' / whox: head / whox: test ', 2) with (D nvarchar (50)' text () ') EXEC SP_XML_REMOVEDOCUMENT @doc

Fetch The Node Value in The Same Parent with Same Name

Declare @xml nvarchar (1000) set @xml = '

TEST1

TEST2

'DECLARE @Doc int EXEC sp_xml_preparedocument @Doc OUTPUT, @xml select * FROM OpenXml (@Doc,' / head / test ', 1) with (comment nvarchar (300)' text () ') EXEC sp_xml_removedocument @Doc

Update and INSERT OPERATE with OPENXML

- INSERT INSERT INTO FND_TABS SELECT * from OpenXML (@doc, '/ newdataset / table1', 2) with fnd_tabs

转载请注明原文地址:https://www.9cbs.com/read-17613.html

New Post(0)