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
1
vote
1 answer

Perform XQuery based on parameter value + SQL

This is how my XML looks like : THE CONSUMER STATES THIS…
Gauranga
  • 127
  • 6
1
vote
1 answer

Getting the data of Ancestor node + XQuery-Sql

This is how my XML looks like : THE CONSUMER STATES THIS…
Gauranga
  • 127
  • 6
1
vote
1 answer

SQL XQuery Selector for Key/Value Pairs

I have some xml in a column like this.
Jason Smith
  • 333
  • 3
  • 15
1
vote
1 answer

Output XML nodes by checking if all their successors elements nodes values are greater than a certain fixed value?

I have the following document where I want to select all nodes with their associated IDs iff all their successor node elements are greater than 300. 1200 5000
Joe
  • 575
  • 6
  • 24
1
vote
1 answer

Using MarkLogic to counting

I am a beginner in the field of MarkLogic and need help in solving this question with clarification please. This is an example of xml classes. I need a function to count the number of classes a student attends, use map
noons
  • 13
  • 4
1
vote
2 answers

Transformation of XML tree to flat text using SQL Server 2008 XQuery

I have some XML data representing a mathematical expression tree and want to convert this to a flat math formula. Sounds simple, but the XQuery restrictions in SQL Server currently stopped me from succeeding (no recursive functions, problems with…
Lucero
  • 59,176
  • 9
  • 122
  • 152
1
vote
1 answer

T-sql select xml value

Greggz
  • 1,873
  • 1
  • 12
  • 31
1
vote
1 answer

How to extract XML node value?

I'm trying to create an SQL function that returns comma separated value of all months that have the value true by reading the xmlNode. However, I'm unable to navigate to the months node at all. Adding namespace to the path hasn't helped me extract…
1
vote
1 answer

XQuery Error when reading attribute from parentnode with *typed* XML (value() requires a singleton)

I have a simple XML: DECLARE @x1 xml = ' '; And select the following: SELECT r.o.value('(../@a)[1]','varchar(20)') FROM @x1.nodes('/r//o') r(o); Everything is nice: NULL 1 When I use…
1
vote
1 answer

T-SQL get value from XML node if node exists and fits schema

I'm trying to read data from a KML file source. Part of what I need to read is styling information. Different styling rules are declared at the root level as