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

SQL Server - view Nodes elements in Xquery

DECLARE @x xml SET @x=' a b c '; SELECT s.value('.', 'VARCHAR(8000)') AS…
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
0
votes
1 answer

Shredding XML data in SQL Server

I need to import the following XML into SQL Server 2008 R2:
Raj
  • 10,653
  • 2
  • 45
  • 52
0
votes
1 answer

How do I select a maximum date from SQL Server 2005 XML Column?

I am new to XML programming in SQL Server. This will probably be a simple question for you guys! I have a database table called TestXML, in SQL Server 2005. It has one column testXML with xml datatype. The data in this column is in the following…
Narayan Akhade
  • 2,694
  • 3
  • 21
  • 30
0
votes
3 answers

xquery in sql server 2008

what is the best xquery method to get the max attribute value from the document. Eg I want the query to return 11.…
Daniel
  • 155
  • 2
  • 11
0
votes
2 answers

Inserting new value into multiple node instances

I am trying to update a SSRS report XML so that every single report parameter has the true value set on it. Some parameters will already have the value and can be skipped. In theory if that value is set to false in the designer,…
svenGUTT
  • 399
  • 4
  • 11
0
votes
1 answer

Finding XML elements by value even when the parent element is different

I have a SQL Server database table with a XML column, and I want to extract some specific data from it. Unfortunately, the XML structure changes depending on what type of item is being used. For example, the XML for a type one item would look like…
Duncan
  • 15
  • 4
0
votes
1 answer

Sql Statement for a particular xpath

I have a XPath statement that works well on my xml. //PaymentProperty[Name='PaymentReference']/StoredStringValue When I store this xml in mytable.xmlField, is there a way to get this value from SQL? I tried select …
user2184523
  • 41
  • 1
  • 8
0
votes
2 answers

XQuery On SQL Server - Performance Issues

Working on XQuery in SQL Server. My understanding was that using CROSS/OUTER APPLY for the nodes would help improve performance, however the top query (below) performance SIGNIFICANTLY worse than the lower. Can anyone help explain why that is, and…
Jake
  • 893
  • 2
  • 9
  • 17
0
votes
0 answers

Join Oracle Xquery

I have a Oracle table with a XML field and another table which contains a list of TAG which I need to find on first table. On second table I have another field to remap TAGs. The second table may have also null…
0
votes
1 answer

XML data to SQL tables, difficulty gettting child node data

I have an xml file that I am loading into SQL. I have no problem getting the xml file loaded and the top level nodes into a sql table. I am having difficulty reaching the next level child node. Here is an example xml file (similar to what I am…
Pflipper
  • 88
  • 6
0
votes
1 answer

Set XML column dynamically

I want to modify a value inside an XML tag dynamically, the stored procedure runs correctly but does not modify the value. This is the query: DROP TABLE IF EXISTS #IDsToUpdate SELECT biCustNoteID, biAccountID INTO #IDsToUpdate FROM tbCustNote WHERE…
0
votes
1 answer

Transact sql (2012) Using @xml.modify to insert 'elements using a variable

I need to add an element using a variable This works -- declare @XML xml = '
0
votes
1 answer

how to sum all of the count items in xquery

My problem is i want to display the count of all genre that is equals to actions `
0
votes
1 answer

Loading the data into Netezza database using xquery from XML source

I have a source as XML and has a huge number of records. just for the sample I have pasted 1 record below :
ImSahil
  • 45
  • 4
0
votes
1 answer

How to extract repeating data from XML in SQL Server

How do I return all the barcode exceptions (with the barcode range IDs)? The SELECT statement below only returns the first instance of a barcode exception. I cannot change the data format or the way I get it (i.e. in a temp table) -- only the SELECT…
Craig
  • 4,111
  • 9
  • 39
  • 49