Questions tagged [xquery-sql]

the XQuery language as supported by database systems. Include the tag of your system to specify ("sql-server", "oracle", "postgresql", etcetera). Use the "xquery" tag on its own for general questions about XQuery.

XQuery is a query language designed to extract data from arbitrary XML documents. Multiple RDBMSes support XQuery as part of the SQL/XML standard or using proprietary syntax. What follows is a non-exhaustive list.

Microsoft SQL Server

In SQL Server 2005 and onwards, the xml data type methods, in particular .query(), support querying XML and returning the results as relational data. These methods support a subset of XQuery, with special support for some T-SQL specific constructs like variables -- see the XQuery Language Reference for specifics.

Oracle

Oracle includes XML support as Oracle XML DB. It supports XQuery both for querying and updating data, both relational and XML. The XMLQUERY function is used to issue XQuery queries within an SQL statement.

453 questions
0
votes
0 answers

How to delete specific comment found before root node from XML form using XQuery on SQL Server?

The comment is before the root node and I want to delete the "comment 1" line.
Yashi Arya
  • 11
  • 1
0
votes
1 answer

How to manipulate the attribute value in xml data and insert into database

How to manipulate the language attribute value in the following example, say to select EN1. DECLARE @xml XML SET @xml = N'' SELECT T.C.value('@language', 'nvarchar(100)') FROM…
InquisitiveLad
  • 309
  • 3
  • 16
0
votes
1 answer

XQuery "Cannot conver to xs:double"

Im new to learning XQuery and im not sure why i get the error "Cannot conver to xs:double" for the following code: for $element in db:open("data", "restaurants_basex.json")/json/_ where ($element/grades/_/score > 80 and $element/grades/_/score <…
Winston
  • 15
  • 5
0
votes
1 answer

How to update XML attributes based on existing values in SQL?

I have a lot of XML documents in the app which are stored in the SQL Server database. Here is an example: test
0
votes
1 answer

SQL Server XML Nested Values Query Form 990

My XML file is as listed below. The XML document is in a table called form990 My query is supposed to return the value for the tag OfficerInd. There are several different versions of this tag (nested values) so I attempt to return all the values.…
TenkMan
  • 27
  • 4
0
votes
1 answer

Concatenate XML Attributes SQL Server

I have an XML data set that which defines a list of Customers and all the Products the customer has purchased
0
votes
1 answer

Transform XML with xsi:nil="true" into a series of name-value pair

I use this compare script . The script doesn't support NULL values in fields. To generate the first XML I use now "FOR XML AUTO, ELEMENTS XSINIL" new 505
Angelus
  • 1
  • 1
0
votes
1 answer

How to insert XML column of a table in to another table incuding the same fields

I have a table including XML column which it's Name is Bookmarks and result of select query would be Like this: SELECT [Bookmarks] FROM [prs_Decrees]
mehrab habibi
  • 427
  • 1
  • 5
  • 16
0
votes
2 answers

Parse XML - Retrieve the Portion Between the Double Quotes

I have the following XML that is in an XML column in SQL Server. I am able to retrieve the data between the tags and list it in table format using the code at the bottom. I can retrieve the values between all the tags except for the one I have in…
0
votes
2 answers

Write a SQL Server query to modify XML tag not value

In my table column I have a value like:
0
votes
1 answer

How to query SQL Server XML column

I have a table which contains a XML column and I need to get a value from the XML. Member_Claim_Id 1802538 Reverify 0
David.Warwick
  • 620
  • 1
  • 9
  • 28
0
votes
1 answer

Select all XML nodes and generate SQL Server table

I got stuck in SQL - can anyone please help? I have a XML shown below; I want to read the XML tags and create a table in SQL Server. I tried the query also shown below, but that did not fetch the data. The result set is empty. I have used cross…
0
votes
1 answer

How to shred XML with TSQL XQUERY

I'm struggling to shred the following XML. I'm using Azure SQL database. Here's my sample data and code attempt. DROP TABLE IF EXISTS #t ; CREATE TABLE #t (XMLResult XML) ; INSERT INTO #t (XMLResult) VALUES ( '
Geezer
  • 513
  • 5
  • 17
0
votes
1 answer

TSQL XML - Node attributes as columns or rows in same query

I'm working with an XML file with a node similar to this: Enable Mixers Enable Mixers1
Gaius Augustus
  • 940
  • 2
  • 15
  • 37
0
votes
2 answers

TSQL - Parse XML metadata & values dynamically

Background I have an XML column in my SQL table (using SQL Server). Each node has a different amount of metadata. For example, in the below example, Step Number 1 has the only "No" as metadata while, Step Number 2 additionally has RBuffer.
Gaius Augustus
  • 940
  • 2
  • 15
  • 37