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

Import nested XML file to SQL Server

I have the following problem and have no idea how to import the data from a nested xml file to the database. Here the example of the xml file:
yuro
  • 2,189
  • 6
  • 40
  • 76
-1
votes
1 answer

how to query msdb.dbo.sysssispackages.packagedata

I read this thread Query msdb.dbo.sysssispackages XML for specific values but I need to know how I can get values "down the xpath" sort of speak here is the snippet of the xml
user2836030
  • 9
  • 1
  • 1
  • 3
-1
votes
1 answer

Converting XML column to separate columns in SQL server

I have to create queries on a SQL Server database that stores the relevant data attributes for each line in a single XML column. The list of attributes in that column is formatted like this: APPLE
-1
votes
1 answer

Query from XML stored in database as nvarchar

I have xml data stored in one column of my table. Column datatype is nvarchar(max). I need to query data from the column to extract some nodes information. Below is the example xml data stored 1
CellX
  • 11
  • 3
-1
votes
1 answer

SQL Server - XQuery: delete parent node based on child value substring

I want to delete all parent nodes TxDtls of the following XML where position 20 of child value Ref is 2.
M4tee
  • 31
  • 4
-1
votes
1 answer

query SQL in VBA excel

i connect my excel to MS SQL and i want excute the query : SELECT * FROM Customers WHERE Country='Germany' AND (City='Berlin' OR City='München'); and its work fine i want use it on vba: Set rs=c.Execute(“SELECT * FROM Customers" & _ WHERE…
Salim Fh
  • 75
  • 6
-1
votes
1 answer

XQuery - List name and population of the most populous country on each continent

I have to do the following exercise but I don't know do it. List the name and population of the most populous country on each continent. It is forbidden to use the ids of the 5 continents in the query, ie neither “f0_119”, nor “f0_123”, nor…
-1
votes
1 answer

Xquery with multiple elements

I have a XML named 'fruits.XML' as follows 123 Apple 1 Apple 2 1 Apple 2
Punkster
  • 221
  • 6
  • 17
-1
votes
1 answer

XPath test for node exists and contains a number

I need a condition in XPath or XQuery to determine if a product has the node Id and if that node has a number. 100 104
Monik Eliz
  • 107
  • 9
-1
votes
1 answer

Overwriting Values From SQL Table to Another SQL Table

I have 2 databases, a live and backup. I want to overwrite the the values in a specific field in the live database from those that are in the backup. The database structure is identical the only difference is there name. How do I do this?
TowelsRus
  • 55
  • 2
  • 9
-2
votes
1 answer

Using xQuery to retrieve table records with condition on xml column

I need help with xQuery syntax. I have a table with a column declarde with the SQLType xml. My table I would like to create a sql query, using xQuery, to retrieve table records where the xml contains any element, in the xPath, where it's attribute…
-2
votes
1 answer

XQuery select and check existing employee with message

i need to output a message saying "matched" or "not an employee" in a column using xquery. I'm using 4444 as a placeholder for now, dont know how to iterate through within the query SELECT EXTRACTVALUE(B.JOBSHEET_DETAILS, '/jobSheet[@jobNo]/@jobNo')…
mewc
  • 1,253
  • 1
  • 15
  • 24
-2
votes
1 answer

XML data retrieval when tags are of same name using sql server

For the below XML: 1000 USD Sales 5000 USD
Kapil
  • 987
  • 5
  • 11
-2
votes
1 answer

Convert xml data to table format

I have a table X with one column as Body and its datatype is nvarchar(max). The values in this column is as below( this is the body of an email which is copied and pasted in the Body column of table X through a sql server job,sample is as below). It…
Sachin25
  • 17
  • 1
  • 6
-2
votes
3 answers

XQuery To Select Related Node

Given the below XML, what would be the proper SQL XQuery to retrieve the SubscriberStatus where the SubscriberID is empty? Given the XML is stored in a column with the XML datatype. Key1
Steve Wall
  • 1,842
  • 5
  • 21
  • 50
1 2 3
30
31