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

Partial Wildcard Searches in SQL Server XML Columns

I have an XML column in a MS SQL Server 2012 database that I need to create a query for that extracts the nodes into a table. Here's a gist of the XML structure:
JNYRanger
  • 6,829
  • 12
  • 53
  • 81
0
votes
1 answer

SQL Server: is it possible to change the value of a complex XML element?

I need to change a value within a XML element - for this untyped version it works this way: declare @X xml= ' example Beispiel '; set @X.modify('replace value…
bert
  • 35
  • 1
  • 7
0
votes
1 answer

Replace XML Span Element with Inner text of Span Tag in SQL Server

Replace span Element with its inner text whose class is "TAGGED_ITEM " in multiple rows with a column of type XML
Chat
  • 185
  • 1
  • 5
  • 15
0
votes
2 answers

XQuery update for document with versions

I am trying to update value of some property in xDB using XQuery, here is my transaction: let $source := doc('/historicalresource')/HistoricalResourceData[id/@UUID = '0361513e-30fa-45e4-a73a-d05870b8a284'] let $res :=…
Anahit Serobyan
  • 432
  • 1
  • 6
  • 17
0
votes
1 answer

How to capture error when insert/update bulk xml data using merge statement

I like to know when we insert/update bulk data using merge statement then how to capture error if there is problem in data of records. See a sample xml: 1
Thomas
  • 33,544
  • 126
  • 357
  • 626
0
votes
1 answer

Update xmlstate in tsql column based on other attributes

Struggling abit with an update to a column storing xml data in tsql. Basically I want to update the rows where a certain flag is missing. I have an advantage in that I know that if the attribute part_id=1 is present then the attribute i want to add…
Mark O Keeffe
  • 191
  • 2
  • 15
0
votes
1 answer

replace XMLNode in a XMLString Column of a table in SQL Server

I want to delete xmlnode whose attribute "identifier" value is not "RESPONSE" from table "Rubric"; which has column "XMLString" of type String and "XMLNode" column of type Xml.Before deleting the node ""…
Chat
  • 185
  • 1
  • 5
  • 15
0
votes
1 answer

Pivot XML using XQuery and filter on attribute

Given the following XML (in an SQL column field called 'xfield'):
987 654 321
grenade
  • 31,451
  • 23
  • 97
  • 126
0
votes
1 answer

Using XQuery to return multiple attributes using different conditions

I am new to XQuery and I am trying to figure out something really simple but I seem to be failing miserably. I have an XML file of Employees in a Company which looks like this: John
0
votes
2 answers

How to get node content based on sibling content from xml column in database?

a1 t1 a1 t2 a2 t3 a3 t4 I want to get all titles and…
Ching Liu
  • 1,527
  • 2
  • 11
  • 15
0
votes
0 answers

XML X-query to fetch data from an xml in a column in a table in ORACLE database

I am trying to write an xquery to read values from an xml and display in table format(XML table), instead of going to an xml and searching for value of a field. I am got the below error : (The location mentioned is the “xmlcolumnname” that is…
tushar9898
  • 11
  • 1
  • 5
0
votes
2 answers

SQL query with XML parameter

EDIT: I have found a relevant answer already on stack overflow here: XQuery [value()]: 'value()' requires a singleton (or empty sequence), found operand of type 'xdt:untypedAtomic *' I have not dealt with XML in T-SQL before, and I am modifying an…
Darrell
  • 1,905
  • 23
  • 31
0
votes
2 answers

SQL Server : optimize TSQL query with XQuery

In SQL Server 2012 I have a table with 1 row which contains a XML column - XMLdata. Size of a XML is around 10 MB. I wrote a query but execution takes around 1 hour. Are there any options how to rewrite query that it will work faster? Structure of…
Hemus San
  • 379
  • 1
  • 5
  • 21
0
votes
2 answers

If condition on Selecting XML node in SQL

I am trying to read the xml and storing it in SQL server. DECLARE @xml XML SET @xml = ' SearchName
user1893874
  • 823
  • 4
  • 15
  • 38