{"id":27253,"date":"2023-07-21T06:16:00","date_gmt":"2023-07-21T04:16:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=27253"},"modified":"2023-10-03T18:21:56","modified_gmt":"2023-10-03T16:21:56","slug":"xml-query-method-sql-server","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/","title":{"rendered":"How to use the XML query() Method in SQL Server?"},"content":{"rendered":"\n<p>The XML query Method in SQL Server is very powerful. Indeed, XML is one of the most ubiquitous data formats, and its significance in SQL Server is no different. XML data can be stored in tables and queried just like relational data, offering the best of both worlds.<\/p>\n\n\n\n<p>In today&#8217;s data-driven landscape, the capability to efficiently manage and manipulate XML data has never been more critical. It&#8217;s not just about storing XML data, but effectively querying it to derive meaningful insights that can drive decision-making.<\/p>\n\n\n\n<p>One of the essential tools for dealing with XML data in SQL Server is the <code>query()<\/code> method, which allows you to retrieve specific parts of an XML document. Today we&#8217;re diving deep into this T-SQL feature, using a Sales table example to illustrate how it works. We will be dissecting the method&#8217;s syntax, exploring practical use-cases, and even delving into some advanced functionalities. By the end of this guide, you&#8217;ll have a strong grasp of how to utilize the <code>query()<\/code> method effectively, enhancing your XML data operations within SQL Server.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#the-importance-of-the-xml-query-method\" >The importance of the XML query() Method<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#set-up-the-xml-example-table\" >Set up the XML example table<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#populate-the-sales-table\" >Populate the sales table<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#understand-the-query-method-syntax\" >Understand the query() Method Syntax<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#a-practical-sql-example-with-the-query-method\" >A practical SQL example with the query() Method<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#query-to-extract-multiple-xml-nodes-at-once\" >Query to extract multiple XML nodes at once<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-the-importance-of-the-xml-query-method\"><span class=\"ez-toc-section\" id=\"the-importance-of-the-xml-query-method\"><\/span>The importance of the XML query() Method<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The XML query() method allows to precisely query within <a href=\"https:\/\/expert-only.com\/lessons\/import-an-xml-document-into-sql-server\/\"><strong>XML columns<\/strong><\/a>. This is useful for tasks such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Extracting specific XML nodes for further analysis.<\/li>\n\n\n\n<li>Navigating through hierarchical XML data structures.<\/li>\n\n\n\n<li>Simplifying complex XML data into digestible fragments.<\/li>\n<\/ul>\n\n\n\n<p>The utility of query() cannot be overstated for databases that store XML data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-set-up-the-xml-example-table\"><span class=\"ez-toc-section\" id=\"set-up-the-xml-example-table\"><\/span>Set up the XML example table<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To demonstrate how the query() method works, let&#8217;s first create a Sales table with an XML column named <em>ProductDetails<\/em>, associated to the SalesID primary key. These columns will store the product data associated with each sale. Here&#8217;s the SQL code to create the table:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE TABLE Sales (\n  SalesID INT PRIMARY KEY,\n  ProductDetails XML\n);\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-populate-the-sales-table\"><span class=\"ez-toc-section\" id=\"populate-the-sales-table\"><\/span>Populate the sales table<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Next, let&#8217;s populate the table with some sample data. We&#8217;ll insert two sales records with detailed XML data about the products involved in each sale.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">INSERT INTO Sales (SalesID, ProductDetails)\nVALUES (1, '&lt;Product>&lt;Name>Laptop&lt;\/Name>&lt;Price>800&lt;\/Price>&lt;Stock>120&lt;\/Stock>&lt;\/Product>');\n\nINSERT INTO Sales (SalesID, ProductDetails)\nVALUES (2, '&lt;Product>&lt;Name>Smartphone&lt;\/Name>&lt;Price>500&lt;\/Price>&lt;Stock>200&lt;\/Stock>&lt;\/Product>');\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-understand-the-query-method-syntax\"><span class=\"ez-toc-section\" id=\"understand-the-query-method-syntax\"><\/span>Understand the query() Method Syntax<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The query() method is relatively easy, and it is used as in the generic code below. Here, the <strong><em>XQuery_expression<\/em><\/strong> allows to specify which XML nodes to extract. It is passed as a string argument to the <strong><em>query()<\/em><\/strong> method.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT column_name.query('XQuery_expression')\nFROM table_name;\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-a-practical-sql-example-with-the-query-method\"><span class=\"ez-toc-section\" id=\"a-practical-sql-example-with-the-query-method\"><\/span>A practical SQL example with the query() Method<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Let&#8217;s use the query() method to extract the <em>&lt;Price&gt;<\/em> element from the XML stored in the <em>ProductDetails<\/em> column for the sale with <em>SalesID = 1<\/em>.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT ProductDetails.query('\/Product\/Price') as ProductPrice\nFROM Sales\nWHERE SalesID = 1;\n<\/pre>\n\n\n\n<p>The output will be an XML fragment containing the &lt;Price&gt; element from the <em>ProductDetails <\/em>column. Specifically, it will return <code><em>&lt;Price&gt;800&lt;\/Price&gt;<\/em><\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-query-to-extract-multiple-xml-nodes-at-once\"><span class=\"ez-toc-section\" id=\"query-to-extract-multiple-xml-nodes-at-once\"><\/span>Query to extract multiple XML nodes at once<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You can also use the query() method to extract multiple <a href=\"https:\/\/www.w3.org\/XML\/\" target=\"_blank\" rel=\"noreferrer noopener\">XML file<\/a> nodes. For example:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT ProductDetails.query('\/Product\/*') as ProductAllDetails\nFROM Sales\nWHERE SalesID = 1;\n<\/pre>\n\n\n\n<p>This query will return all child elements of &lt;Product&gt;, which in our example would be <em>&lt;Name&gt;Laptop&lt;\/Name&gt;&lt;Price&gt;800&lt;\/Price&gt;&lt;Stock&gt;120&lt;\/Stock&gt;<\/em>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-conclusion-on-xml-query-method\">Conclusion on XML query() method<\/h3>\n\n\n\n<p>The XML query method in SQL Server offers a robust and flexible way to <a href=\"https:\/\/expert-only.com\/en\/t-sql\/xml-data-in-sql-server\/\">interact with XML data<\/a>. Whether you need to retrieve a single node for analysis or multiple nodes for more complex processing, query provides a powerful mechanism to achieve these tasks.<\/p>\n\n\n\n<p>As databases continue to evolve, blending structured and semi-structured data, mastering XML methods like query will become increasingly important.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>The XML query Method in SQL Server is very powerful. Indeed, XML is one of the most ubiquitous data formats, and its significance in SQL Server is no different. XML data can be stored in tables and queried just <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/\" title=\"How to use the XML query() Method in SQL Server?\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":10754,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[454],"tags":[],"class_list":{"0":"post-27253","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-t-sql"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.7 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to use the XML query() Method in SQL Server? T-SQL<\/title>\n<meta name=\"description\" content=\"Use the XML query() Method in SQL Server with T-SQL queries to extract and display one or multiple nodes as fragments of the XML data.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to use the XML query() Method in SQL Server?\" \/>\n<meta property=\"og:description\" content=\"Use the XML query() Method in SQL Server with T-SQL queries to extract and display one or multiple nodes as fragments of the XML data.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL and IT Tutorials\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-21T04:16:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-03T16:21:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/matrix-69E193580C5_1920x1080-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Expert-Only\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@expert_only\" \/>\n<meta name=\"twitter:site\" content=\"@expert_only\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Expert-Only\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"How to use the XML query() Method in SQL Server?\",\"datePublished\":\"2023-07-21T04:16:00+00:00\",\"dateModified\":\"2023-10-03T16:21:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/\"},\"wordCount\":555,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/matrix-69E193580C5_1920x1080-1.jpg\",\"articleSection\":[\"T-SQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/\",\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/\",\"name\":\"How to use the XML query() Method in SQL Server? T-SQL\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/matrix-69E193580C5_1920x1080-1.jpg\",\"datePublished\":\"2023-07-21T04:16:00+00:00\",\"dateModified\":\"2023-10-03T16:21:56+00:00\",\"description\":\"Use the XML query() Method in SQL Server with T-SQL queries to extract and display one or multiple nodes as fragments of the XML data.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/matrix-69E193580C5_1920x1080-1.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/matrix-69E193580C5_1920x1080-1.jpg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use the XML query() Method in SQL Server?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/expert-only.com\/en\/#website\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"name\":\"SQL and IT Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/expert-only.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/expert-only.com\/en\/#organization\",\"name\":\"Expert-Only\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"width\":381,\"height\":174,\"caption\":\"Expert-Only\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\",\"https:\/\/x.com\/expert_only\",\"https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\",\"name\":\"Expert-Only\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"caption\":\"Expert-Only\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to use the XML query() Method in SQL Server? T-SQL","description":"Use the XML query() Method in SQL Server with T-SQL queries to extract and display one or multiple nodes as fragments of the XML data.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/","og_locale":"en_US","og_type":"article","og_title":"How to use the XML query() Method in SQL Server?","og_description":"Use the XML query() Method in SQL Server with T-SQL queries to extract and display one or multiple nodes as fragments of the XML data.","og_url":"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2023-07-21T04:16:00+00:00","article_modified_time":"2023-10-03T16:21:56+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/matrix-69E193580C5_1920x1080-1.jpg","type":"image\/jpeg"}],"author":"Expert-Only","twitter_card":"summary_large_image","twitter_creator":"@expert_only","twitter_site":"@expert_only","twitter_misc":{"Written by":"Expert-Only","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"How to use the XML query() Method in SQL Server?","datePublished":"2023-07-21T04:16:00+00:00","dateModified":"2023-10-03T16:21:56+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/"},"wordCount":555,"commentCount":0,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/matrix-69E193580C5_1920x1080-1.jpg","articleSection":["T-SQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/","url":"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/","name":"How to use the XML query() Method in SQL Server? T-SQL","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/matrix-69E193580C5_1920x1080-1.jpg","datePublished":"2023-07-21T04:16:00+00:00","dateModified":"2023-10-03T16:21:56+00:00","description":"Use the XML query() Method in SQL Server with T-SQL queries to extract and display one or multiple nodes as fragments of the XML data.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/matrix-69E193580C5_1920x1080-1.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/matrix-69E193580C5_1920x1080-1.jpg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/t-sql\/xml-query-method-sql-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"How to use the XML query() Method in SQL Server?"}]},{"@type":"WebSite","@id":"https:\/\/expert-only.com\/en\/#website","url":"https:\/\/expert-only.com\/en\/","name":"SQL and IT Tutorials","description":"","publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/expert-only.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/expert-only.com\/en\/#organization","name":"Expert-Only","url":"https:\/\/expert-only.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","width":381,"height":174,"caption":"Expert-Only"},"image":{"@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ExpertOnlyCom\/","https:\/\/x.com\/expert_only","https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA"]},{"@type":"Person","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef","name":"Expert-Only","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","caption":"Expert-Only"}}]}},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/27253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=27253"}],"version-history":[{"count":14,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/27253\/revisions"}],"predecessor-version":[{"id":27267,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/27253\/revisions\/27267"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/10754"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=27253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=27253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=27253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}