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

Find if a list contains several values - SQL Server Xquery

I am storing a XML data into a table called BikeTable. The XML data is coming from an object that is being serialized using .Net serializer. BikeTable would look like this : Id - UniqueIdentifier XmlData - XML The XML stored in the XmlData column…
Guigui
  • 1,105
  • 1
  • 11
  • 21
0
votes
1 answer

value() and nodes() method in SQL server

Here is my code DECLARE @dataModel XML SET @dataModel = '
Mar1009
  • 721
  • 1
  • 11
  • 27
0
votes
2 answers

Parse an XML value with a colon in SQL Server

I need help to parse XML in SQL Server. I need to get "d1p1:Val2" value and concatenation of values for "d2p1:string".
Bohdan
  • 3
  • 2
0
votes
1 answer

Use the result of an XQuery value() query in another XQuery value() query in SQL Server

I'm trying to query the SSRS .rdl files which are in xml format. Here is an example of the relevant parts of the xml:
0
votes
1 answer

Remove attribute from all nodes of XML in SQL

How can the remove the attribute "CRS" from all the nodes of the XML through T-sql. Looking to remove the attribute "CRS" if exist in the XML.

Chat
  • 185
  • 1
  • 5
  • 15
0
votes
1 answer

Grouping results in SQL Server 2005 using xquery

I am trying to extract data, to use in a rss feed for google base currently using SQL Server 2005. There a few problems we have, which i hope can be solved! namespaces grouping My current sql is as follows: SELECT [xml].query('
Treemonkey
  • 2,133
  • 11
  • 24
0
votes
1 answer

SQL Server remove namespaces default

I am using Xquery on sql 2008 server and the results contain namespace prefixes (example p1 :) that are generated automatically. I am using a default namespace. How to remove them? Example / flow: 1- SET @ROOMLIST='
npalle
  • 71
  • 1
  • 11
0
votes
0 answers

XQUERY-SQL Oracle 12C Concatenate repeated tags

new to xquery here. I'm trying to insert to a table, a list of values from an xml table. Question: How do I concatenate into 1 db record in 1 column, is that possible? Currently I'm getting this error with the SQL query below: ORA-19279:…
Bao
  • 3
  • 4
0
votes
1 answer

Syntax error for @ sign in XQuery

Im attempting to perform a basic query against some XML in an XML typed SQL Server 2008 field. select OrderId, ProfileXML.query('/IntegrationMessage /Registrant …
ewitkows
  • 3,528
  • 3
  • 40
  • 62
0
votes
1 answer

Xquery only returning a single record

I've been trying to scrape information out of an Extended event I wrote in SQL2008r2 in an attempt to create some better form of error tracking on SQL. I eventually got one working after a lot of trial and error, however it only seems to return the…
Darkestlyrics
  • 310
  • 1
  • 5
  • 16
0
votes
1 answer

Do several modify operations at once

In the code bellow, first there is a element that needs to be add, them in the rest of the code one attribute named t is created or updated. declare LOG_REFERENCE xmltype:=xmltype(''); begin select XMLQuery(' copy $p := $p1 modify…
Higarian
  • 533
  • 5
  • 11
0
votes
1 answer

Sort attributes in each node in XML

I have an XML like this Need to sort names of attributes by alphabet order. Like this:
Ivan
  • 85
  • 6
0
votes
2 answers

Using XML in SQL — performance

First of all, I am using untyped XML. Secondly, I am using SQL Server. Recently I got familiar with XML in SQL and have one question: which of presented approaches is better in terms of performance (in this example the difference would…
Michał Turczyn
  • 32,028
  • 14
  • 47
  • 69
0
votes
1 answer

Extract elements in xml to rows in select statement

I have got xml column in my sql server 2008 database. XML sample in each row of my table val1 val2 val3 val4
marcinn
  • 1,879
  • 2
  • 22
  • 46
0
votes
1 answer

How to output XML node with same name[multiple occurrences] using an XQuery

My XML Response Load appears as below 1 100 200 300 Here 'entries' is…
Tom George
  • 29
  • 1
  • 1
  • 7