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

XQuery sql Join inserts empty node when join does not match

I am using SQL Server 2012 and am looking a way to update my xml column by looking up values from another table. I have a the following schema: USE tempdb; GO DROP TABLE IF EXISTS [dbo].[tblstepid]; CREATE TABLE [dbo].[tblstepid]( [stepid]…
Helen Araya
  • 1,886
  • 3
  • 28
  • 54
0
votes
1 answer

Xquery query to retreive values from associated header for detail

I have XML that I am able to retrieve values from but I am getting duplicates with a solution I am using that worked OK for different structured XML. The XML
Mattias W
  • 105
  • 7
0
votes
1 answer

Using FLWOR to get data from another table

I have a table in SQL Server 2012 with this structure: CREATE TABLE [dbo].[tblStepList] ( [ToDoId] [int] IDENTITY(1,1) NOT NULL, [Data] [xml] NOT NULL ) And the Data column is of type XML and contents like this:
Helen Araya
  • 1,886
  • 3
  • 28
  • 54
0
votes
1 answer

SQL: Update xml column in a table recursively

I have a table in sql server 2012 With the following column definition CREATE TABLE [dbo].[tblStepList]( [ToDoId] [int] IDENTITY(1,1) NOT NULL, [Data] [xml] NOT NULL } And the data column is xml with
Helen Araya
  • 1,886
  • 3
  • 28
  • 54
0
votes
1 answer

SQL: Use modify function to iterate on xml nodes or How to insert or modify nodes recursively

I have an xml as show in the code below I want to iterate though each node and insert one node after each TextReadingName node DECLARE @XML XML = N' e36a3450-1c8f-44da-b4d0-58e5bfe2a987 1
Helen Araya
  • 1,886
  • 3
  • 28
  • 54
0
votes
1 answer

How to filter xml data type column in SQL Server

I have a table with two xml columns and the data inside the table is large. I would like to filter on the column which is of xml type to check if it contains a ID. My sample xml column IncomingXML and value looks like this:
Sam
  • 39
  • 5
0
votes
1 answer

Navigate multiple nodes Xquery xml SQL Server 2019

Hi i have the current XML: 1 MAXI MERCADO SELECTO 2
alexistkd
  • 906
  • 2
  • 14
  • 34
0
votes
1 answer

How to exclude specific nodes from XQuery search?

I have following script which actually will add Test="Value" attribute to all nodes in xml document: declare @xml XML = ' test2 test test test ' while…
0
votes
1 answer

XML to SQL table (epcis:EPCISDocument)

Could you help me here, please? I need to do a query with an XML file, however, it has something different because it has the epcis: at the beginning of the XML document. So, if I try to do the query with epcis: and dts: the result is: Msg 2229,…
Juan
  • 34
  • 3
0
votes
1 answer

xQuery value returns null for valid XML tags

I have multiple XMLs in the following format:
Maria
  • 3
  • 2
0
votes
1 answer

Replacing XML namespace to use XQUERY

I have a sample input looking like below in one of the columns in the table.
sasi
  • 17
  • 5
0
votes
1 answer

Replacing values in the XML nodes to reference nodes correctly using XQUERY and filter required values

I've have a table which contains XML data with several nodes in one of the columns. Something similar to the below.
sasi
  • 17
  • 5
0
votes
1 answer

How to write a xquery in SQL Server to read all the childnodes from an XML data column in a table?

I have a table in SQL server named as [QueryResult] with columns of type Init, of type XML. Here is the sample XML of Result column data. 2023038.09 265127.97
Charan
  • 13
  • 2
  • 5
0
votes
1 answer

All steps required to produce a XML file from a SQL Server table

I need to produce output in specified XML format, thought it would be easy in 2021, tried first to convert it into XSD using online services and use it with my SQL (using CREATE XML SCHEMA COLLECTION Schema1 AS @Schema1);but this didn't work, I…
Mich28
  • 519
  • 3
  • 14
0
votes
1 answer

How to replace value with another value of a node in XQuery?

I have a table in SQL Server 14.0, which is called Users .There are multiple users and each of the user has a column data called as PermissionData which is in XML format. The following is the XML :