About 266,000 results
Open links in new tab
  1. How do I iterate through the Nodes of a XML Field in T-SQL?

    You can just use sql:variable to satisfy nodes () requirement of a string literal argument to query sub elements of a specific node iteratively. Child.value('(SomeElement)[1]', 'int'), Child.value('(SomeOtherElement)[1]', 'Varchar(50)'), XMLField.nodes("/RootNode/ParentNode[sql:variable("@iterator")]/ChildNode") AS N(Child)

  2. sql server - How to query values from xml nodes? - Stack Overflow

    SELECT foo.value('/ReportHeader/OrganizationReportReferenceIdentifier') AS ReportIdentifierNumber, foo.value('/ReportHeader/OrganizationNumber') AS OrginazationNumber FROM CDRBatches.RawXML.query('/GrobReportXmlFileXmlFile/GrobReport/ReportHeader') foo

    Missing:

    • Traverse

    Must include:

  3. Traverse an XML Document in a SQL Server 2008 Database Column

    Nov 13, 2009 · I am looking to traverse an entire XML document and query ALL values of the /FuelPathwayCode XML node in one result set? SELECT UploadFileID, Year, Quarter, FileContent.value('(LCFS-Report/Fuel/FuelPathwayCode)[1]', 'varchar(100)') as FuelPathwayCode FROM LC_UploadXM

  4. nodes () Method (xml Data Type) - SQL Server | Microsoft Learn

    Sep 3, 2024 · The query uses the nodes() method to set separate context nodes, one for each <row> element. The nodes() method returns a rowset with three rows. Each row has a logical copy of the original XML, with each context node identifying a different < row > element in the original document.

    Missing:

    • Traverse

    Must include:

  5. Use the value() and nodes() Methods with OPENXML - SQL Server

    Oct 17, 2024 · Learn how to extract a rowset of XML values in a SQL query using the value() and nodes() methods or the OpenXML() method.

  6. Working with XML data in SQL Server - MSSQLTips.com

    Sep 10, 2024 · Run the following query to extract the name of the patients: FROM @Records.nodes('Patients/Patient') AS Rec(Pat); Explaining the code: Now, we will retrieve the remaining data: ,Pat.value('(@Id)[1]', 'nvarchar(50)') AS PatientId. ,Pat.value('(@MedicalRecord)[1]', 'nvarchar(50)') AS MedicalRecord.

  7. Iterate through XML variable in SQL Server - Stack Overflow

    May 11, 2013 · Depending on the size of your XML doc and the number of times you're querying it, you could be best off using sp_xml_preparedocument which parses the document, gives you a handle to reference it, and then you can query it as many times and ways as you want to. Here's how you do that:

  8. List all nodes from XML column in SQL Server - T-SQL Tutorial

    To count the number of nodes in an XML document stored in an XML column in SQL Server, you can use the nodes() method along with the COUNT function. Here's how you can do it: SELECT COUNT(*) AS node_count FROM my_table CROSS APPLY xml_data.nodes('//*') AS xml_table(xml_node)

  9. SQL Tip: The nodes () method (XML) - Benjamin's Blog

    Jun 18, 2019 · To get the XML you can run the following code. And here is that code for reference (sorry, this will take up a lot of space and require a lot of scrolling): The nodes () method is used against XML types in SQL Server to shred or parse the XML. The “nodes” method takes an “XQuery” as its input.

  10. SQL Server XML SELECT child nodes dynamically - T-SQL Tutorial

    In SQL Server, it is possible to query and extract data from XML documents using the SELECT statement. One common scenario is selecting child nodes dynamically from an XML document. To select child nodes dynamically, you need to use the nodes () method and the value () method in conjunction with the SELECT statement.

    Missing:

    • Traverse

    Must include:

  11. Some results have been removed
Refresh