Skip to main content

Questions tagged [xml]

Short for 'eXtensible Markup Language.' A textual markup language for transferring structured data.

Filter by
Sorted by
Tagged with
2 votes
1 answer
702 views

How to load a table using BCP

Context: I created a dump of a sql table in XML (Including data and schema) using this command from the command prompt. BCP "SELECT * FROM Database.Schema.TableName FOR XML AUTO, XMLSCHEMA" ...
LP.'s user avatar
  • 23
0 votes
1 answer
114 views

How extract cldr timezones from xml file to store in a DB table? [closed]

In our DB, I need each location to be associated with a "timezone". These timezones are in https://github.com/unicode-org/cldr/blob/release-36-1/common/supplemental/metaZones.xml I want to make a ...
ToolmakerSteve's user avatar
0 votes
1 answer
5k views

XQuery in SQL Server to convert XML column data to relational data table

I previously asked a question about an error I was recieving. You don't really need it to understand this question but it's here for reference: XML/SQL Server 2008 Error: XQuery...Cannot implicitly ...
Dan's user avatar
  • 167
0 votes
1 answer
638 views

Spooling Oracle XML data results in 1 line and missing data?

I am trying to spool Oracle XML data to a file but the resulting file ends up with 1 line which is stops after a certain amount of characters so doesn't contain all of the data? set colsep , set ...
user306815's user avatar
0 votes
1 answer
239 views

vertica/postgres copy text to binary column

Until now I used Oracle to store xml file in blob data type column. Is there any option in Vertica to copy xml file into binary column? I saw there is varbinary data type but, I haven't succeeded to ...
NoamiA's user avatar
  • 103
0 votes
2 answers
683 views

Get one row for each value in xml column

I have a table, called product_variants, with one integer column and one xml column containing a set of foreign key values. If I ran, select product_id, options_xml from product_variants This would ...
Cory Baumer's user avatar
1 vote
1 answer
292 views

Querying XML Nodes with SQL

I think I'm nearly there with this but have reached an impasse! I've a relatively straightforward XML structure that I need to parse out as a SQL resultset but can't seem to get it to work. Here is ...
david's user avatar
  • 13
3 votes
1 answer
2k views

Postgresql query XMLTable with default namespace

I use PostgreSQL 12 to query XML data. My data is as below CREATE TABLE xmldata AS SELECT xml $$ <ROWS xmlns="http://x.y.z"> <ROW id="1"> <COUNTRY_ID>AU</COUNTRY_ID> ...
wureka's user avatar
  • 159
9 votes
2 answers
625 views

Xml index, slow count of rows

I am not getting index seek in the following scenario. Instead of inserting <Number>xxx</Number> in xml column like in this post Why is the secondary selective index not used when the ...
SomeDude123's user avatar
1 vote
1 answer
934 views

If XML child element value contains string return other child element value at same level

I have a database table named Warehouses that contains rows of data related to specific warehouses. One column in that table is named itemStats and contains XML data in the following format: <...
Lava Viperidae's user avatar
1 vote
1 answer
3k views

Extract Information from XML Document Attributes into PostgreSQL

I am fairly new to SQL, and very unfamiliar with XML. I want to extract the key data from the XML document below into PostgreSQL, but I am having difficulties. Basically, for every data series, I ...
Jacob's user avatar
  • 35
0 votes
1 answer
1k views

How to loop through all table rows and perform subquery using values of same row?

I have a table structured as follows: | reference | valA | valB | xml | 1 NULL NULL <xml stuff> 3 NULL NULL <xml stuff> 4 NULL NULL ...
SimStil's user avatar
  • 15
1 vote
1 answer
2k views

ERROR: invalid XML content, when Select unnest(xpath(... on a text column

I have a text column named big_xml in my table which has the following value: <?xml version=1.0 encoding=UTF-8?> <dpid:DpidDatabase xmlns:dpid=http://ddex.net/xml/dpid/11 xmlns:xsi=http://...
rdee's user avatar
  • 11
4 votes
2 answers
1k views

Search for values in xml data

I have a table of names: Table A John Jim Jason and a table of xml strings: Table B Example 1 <Show Title="" ShowTitle="=False" ShowLine="=False" ShowDescription="=False" ...
pricejt's user avatar
  • 53
0 votes
1 answer
1k views

How to Load XML child nodes in to multiple tables

I would like to load the below XML into 2 tables Table 1: Acct Table - it should have the ACCT_NUM and a Key to tie to the Table 2 below Table 2: Should have all the Contacts (1 record per ...
Deepak's user avatar
  • 3
0 votes
1 answer
762 views

XQquery for specific attribute of all specific elements in XML

I am, looking for a query to get all attribute values "NetAmount" of Element "PRODUCT" from the following samle XML: <ROOT> <CATEGORY name="A"> <PRODUCT NetAmount="10.50"/> <...
Magier's user avatar
  • 4,797
8 votes
3 answers
201 views

XML Query Question

I'm trying to generate a SQL query to get the "DATE" values out of the following SQL XML: I've tried something like this but I don't think I'm understanding the concepts. select xConfig.value('(/...
John's user avatar
  • 81
3 votes
1 answer
858 views

Why is an empty XML node xml datatype not being recognized in this query?

My query seems to not recognize self-closing or empty nodes at all. Shouldn't the empty <td/> node return 'null'? Or an empty string. Even if I place an empty space in the node, it still is ...
user2566049's user avatar
8 votes
2 answers
857 views

XQuery doesn't update XML data

I am trying to run the script to update an XML column: UPDATE DataImpTable SET serviceData.modify('replace value of (/SMObjInfo/CentralData/SMData/CentralSDItem/ControlData/text())[1] with "9876"') ...
S S's user avatar
  • 81
14 votes
3 answers
6k views

Concatenate all values of the same XML element using XPath/XQuery

I have an XML value like this: <R> <I>A</I> <I>B</I> <I>C</I> ... </R> I want to concatenate all I values and return them as a single string: ...
Andriy M's user avatar
  • 23.1k
1 vote
0 answers
1k views

IBM db2 FOR XML equivalent

I've been trying to Query an item with its sublist all in one go and one way is to use for xml and subquery. I've been using this strategy with sql server and works fine. The relationship is Order ...
Carl's user avatar
  • 43
3 votes
1 answer
71 views

ms sql query multiple table colums as identical tag (sequel)

Extending this original question I am using SQL Server Express 2017 Pretending this is my source table: +-------------+---------------------------+ | ID | Name | Age | HairColor | HasCar | +-----...
GeorgeDuke's user avatar
0 votes
2 answers
58 views

ms sql query multiple table colums as identical tag

I am using SQL Server Express 2017 My Table looks like this +-------------+ | ID | Name | +-------------+ | 1 | Bert | | 2 | Agnes | | 3 | Diane | +-------------+ I'm looking for this kind ...
GeorgeDuke's user avatar
2 votes
2 answers
6k views

specify delimiter in openrowset bulk insert

I'm trying to insert data from CSV files into tables using a cursor and open rowset bulk insert. this works for me 99% of the times but if one of the fields in the csv files contains a comma( , ) the ...
sql_girl's user avatar
  • 345
2 votes
1 answer
1k views

SSIS:How retrieve and insert an XML Column

I'm trying to Insert two columns from one table onto another. The first column is an int but the second column is an XML. I'm having issues inserting the xml column In first SQL Task I'm doing a ...
Rachel's user avatar
  • 67
4 votes
1 answer
415 views

T-SQL LIKE Predicate failed to match with whitespace in XML converted varchar

Recently I attempt to search for a particular pattern by converting XML data into varchar(max) although I'm aware it's not the best practice and found out it's not working as expected:- Setup ...
Zephyr's user avatar
  • 203
1 vote
1 answer
4k views

How to insert very big XML data file to PostgreSQL

I'm using PostgreSQL 9.5 and trying to import XML data file to database. To load the XML I use this function from here CREATE OR REPLACE FUNCTION bytea_import(p_path text, p_result out bytea) as $$ ...
BonZ's user avatar
  • 11
4 votes
2 answers
148 views

How can I position the element generated by XMLTEXT in a FOR XML query?

I'm trying to use FOR XML to simulate an OData feed. One of the requirements I have is that somewhere I need an XML element which is constant for all records; I was planning to use the XMLTEXT ...
Glorfindel's user avatar
  • 2,201
1 vote
1 answer
157 views

How to get EstimatedRows values from SQL Server execution plan nodes

When I execute the following code in an Azure SQL Database (v12) or SQL Server 2016 instance, I get values in the EstimatedRowsRead column, but not in the EstimatedRows column, and I'm not seeing why. ...
Mark Freeman's user avatar
  • 2,181
1 vote
0 answers
102 views

PostgreSQL FTS for quoted xml tags - is it possible?

I use Pg FTS to text-search database containing some technical descriptions/comments. Which in particular happen to contain XML snippets. Those are amazingly difficult to find by XML tags. I found ...
Mekk's user avatar
  • 111
0 votes
1 answer
798 views

Where clause in a XML column

I have the following XML column in my Oracle 11 G DB: <?xml version="1.0" encoding="UTF-8"?> <l-analysis version="2.9"> <vehicle> <odo-reading latest="true"> ...
Manuela's user avatar
  • 15
0 votes
0 answers
411 views

Stored procedure or Table Function doesn't return value when parsing XML

Script to create table and function at the bottom of the post: We have lately ran into problem that sometimes our stored procedures or Multi-statement table value that include sql statement parsing ...
Zikato's user avatar
  • 4,812
1 vote
1 answer
238 views

Microsoft Optimal method for columns into 1 word: XML Raw or Concat

What is fastest, performance method to make columns into one word? Does Microsoft have recommendation, or is there performance Big-O studies on FOR XML RAW vs Concat? Company has multiple tables with ...
user avatar
1 vote
1 answer
56 views

Update badly formed XML to allow parsing

I have inherited a production system that needs some fine tuning to enable easy extract of the result set. A record gets added to a table which contains an XML field, with contents similar to the ...
AdzzzUK's user avatar
  • 111
6 votes
1 answer
4k views

How to split XML array into separate rows (while upholding consistency)

I am working on the database dump of this exact stack exchange section. While I am working on it I have encountered one issue that I am currently unable to solve. In the XML File Posts.xml the ...
Chessbrain's user avatar
  • 1,213
16 votes
3 answers
3k views

SQL server changes XML structure when inserted

I'm inserting some XML data to an XML column in SQL server but after the data has been inserted it has been changed by sql server. Here is the data I insert <xsl:value-of select="...
Mr Zach's user avatar
  • 347
1 vote
0 answers
228 views

Converting an XML field to nvarchar causes warning on main SELECT in explain plan

I'm getting a warning on my main SELECT on one field in the explain/execution plan of my query on the following: SELECT ISNULL(CAST(p.loadDiagnostic as nvarchar(4000)),'''') FROM myTable p This ...
shawnyshawny's user avatar
3 votes
2 answers
686 views

XML/SQL Server 2008 Error: XQuery...Cannot implicitly atomize or apply 'fn:data()' to complex content elements

Update 10/30/2018. Just in case anyone is interested, I have started to document at the end of this post what I'm actually doing to solve this, just because I've found some interesting things. ...
Dan's user avatar
  • 167
1 vote
0 answers
119 views

Referencing a value of a prior column in a default expression in xmltable()

I'm trying to reference a preceding column c1 in a default value of another column c2 in the xmltable() function, but I get an error: column c1 does not exist. SELECT * FROM xmltable( '.' PASSING ...
Ivan Ustûžanin's user avatar
0 votes
1 answer
740 views

Help - SQL query // Extracting from XML // getting error if no data found

I am building a query, where I am extract values from XML. I am getting output if the xml has values. But if no xml found am getting error I need help to fill those columns with "yet to get" or ...
Irfan's user avatar
  • 3
-1 votes
1 answer
1k views

Migrate View from Oracle to PostgreSQL (with extractvalue() function)

I'm migrating a database from Oracle to PostgreSQL and have a problem with several Views. I can't find an equivalent function for extractvalue() and xmltype()... NVL(extractvalue(xmltype(METADATA), '...
Renard's user avatar
  • 3
7 votes
3 answers
2k views

How to query against exact values in XML column set

I have a table that contains 80+ sparse columns along with a column set column, this is a brief example: DROP TABLE IF EXISTS #ColumnSet GO CREATE TABLE #ColumnSet ( Id INT NOT ...
mhep's user avatar
  • 750
1 vote
1 answer
158 views

PostgreSQL xmloption setting

How long does changing PostgreSQL's xmloption setting to DOCUMENT from its default CONTENT last? It seems to be DB wide, not Cluster wide (any way to set it on a column by column basis?) It seems to ...
user123495's user avatar
5 votes
1 answer
557 views

How to parse query plans to get a count of nested loop operators with unordered prefetch?

My boss wants me to parse a set of query plans stored in a table and to determine how many nested loop operators with unordered prefetching are present in each plan. I only have around 100 query plans ...
reluctant and angry dba's user avatar
1 vote
2 answers
40 views

Question about database structure for network visualuzation

Hello folks. I have a matrix I created in Excel that shows 17 nodes, each node's connection to every other node (if any), and that connections strength. Note the error in the image, cells that ...
Archimy's user avatar
  • 13
2 votes
1 answer
216 views

How to Store Trees on Disk

I am wondering how to store trees on a physical disk, for perhaps a tree-oriented database like an XML database. Wikipedia states about XML databases: ...custom optimized data structures are used ...
Lance's user avatar
  • 209
4 votes
2 answers
2k views

Use non-printable characters in SQL Server BCP xml format file as TERMINATOR

I have a flat-text data file containing records which fields are separated by the non printable character "File Separator" (0x1c). I am trying to use SQL Server's bcp utility to load this data into my ...
Wouter's user avatar
  • 821
2 votes
2 answers
157 views

XML column list specific value

I have an xml column that looks like this: <document> <item> <key> <string>Michael Burry</string> </key> <value> ...
Peter's user avatar
  • 1,490
0 votes
0 answers
357 views

Importing XML Data into SQL Server Table

So after searching on here, I couldn't find an answer to this problem I am having. I am trying to import StackExchange's DB Dump into SQL Server to do some testing and learning overall. However, they ...
Chessbrain's user avatar
  • 1,213
1 vote
1 answer
6k views

How to update xml using value from a sql query

I have a table with an XML column. I need to insert various nodes and then set those nodes using values from a sub-query. Setup: use tempdb CREATE TABLE [dbo].[Sites]( [SiteID] [int] IDENTITY(...
Sir Swears-a-lot's user avatar

1
2
3 4 5
8