How to query values from xml nodes?

后端 未结 4 1977
既然无缘
既然无缘 2020-11-28 11:57

i have a table that contains an XML column:

CREATE TABLE Batches( 
   BatchID int,
   RawXml xml 
)

The xml contains items such as:

4条回答
  •  再見小時候
    2020-11-28 12:35

    Try this:

    SELECT RawXML.value('(/GrobXmlFile//Grob//ReportHeader//OrganizationReportReferenceIdentifier/node())[1]','varchar(50)') AS ReportIdentifierNumber,
           RawXML.value('(/GrobXmlFile//Grob//ReportHeader//OrganizationNumber/node())[1]','int') AS OrginazationNumber
    FROM Batches
    

提交回复
热议问题