Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [xml]

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

7
votes
1answer
129 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('(/...
3
votes
1answer
23 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 ...
7
votes
2answers
88 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"') ...
14
votes
3answers
607 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: ...
1
vote
0answers
42 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 ...
3
votes
1answer
60 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 | +-----...
0
votes
2answers
43 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 ...
2
votes
2answers
219 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 ...
2
votes
1answer
42 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 ...
3
votes
1answer
133 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 ...
1
vote
1answer
334 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 $$ ...
2
votes
2answers
221 views

Empty closing XML tag instead of self-closing tag

My query is USE ... SELECT @JNo=jour_no from WB_PMS..tblJournal WHERE jour_scode=@Jcode IF EXISTS (SELECT 1 FROM WB_PMS..tblArticle WHERE jour_no=@JNo AND art_no=@ArtNo) BEGIN SET @XML= ...
2
votes
2answers
31 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 ...
1
vote
1answer
38 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. ...
1
vote
0answers
14 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 ...
0
votes
0answers
159 views

Easiest way to update XML inside of a SQL table column?

I have an SQL DB, Directory. It contains a table, dbo.User. Within that table there is a column, Info. The Info column contains ~1000 lines of xml tags. Well I want to modify only one of those tags, ...
0
votes
1answer
40 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"> ...
0
votes
0answers
54 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 ...
1
vote
1answer
120 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 ...
1
vote
1answer
28 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 ...
6
votes
1answer
468 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 ...
15
votes
3answers
1k 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="...
1
vote
0answers
69 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 ...
3
votes
2answers
176 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. ...
1
vote
0answers
18 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 ...
0
votes
1answer
25 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 ...
0
votes
1answer
359 views

INSERT/SELECT xml column from one table to another

First off I apologize for asking a question I'm sure is well answered, however I cannot quite understand what I'm reading. I have an existing table with an xml column. I have a second table with the ...
-1
votes
1answer
117 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), '...
6
votes
3answers
460 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 ...
1
vote
1answer
50 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 ...
5
votes
1answer
468 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 ...
1
vote
2answers
29 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 ...
0
votes
0answers
103 views

sql server - xQuery Select for each element that exists

I have a bit of trouble querying XML columns. This is part of the query I'm trying to use SELECT pof.pofdata.value('InformacionActo[1]/Vehiculos[1]/Vehiculo[1]/@Marca', 'varchar(max)') AS 'marca', ...
2
votes
1answer
39 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 ...
3
votes
2answers
486 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 ...
2
votes
2answers
56 views

XML column list specific value

I have an xml column that looks like this: <document> <item> <key> <string>Michael Burry</string> </key> <value> ...
0
votes
0answers
212 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 ...
0
votes
1answer
2k 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(...
0
votes
1answer
38 views

Loading XML to table producing nothing

I'm trying to import part of an xml file into a SQL Server database, but while the query successfully executes there is nothing in the table. XML: <?xml version="1.0" encoding="utf-16"?> <...
2
votes
1answer
50 views

Explanation of Extended Events xml

I queried an Extended Events session and returned the XML. I am confused on what frame level 1, 2, 3 mean. As well as line, offsetStart and offsetEnd? I am however able to convert the sql handle to ...
2
votes
1answer
246 views

Update xml based off datatype

I need to update a value in my xml datatype column, currently I am able to pull specific values using Select AllUserData.tp_ColumnSet.value('nvarchar13[1]', 'varchar(max)') AS AssetId... My data in ...
10
votes
2answers
1k views

Return xml sequences where an attribute doesn't contain a specific character

Consider the following simple XML: <xml> <customer name="Max"> <email address="me@you.com" /> </customer> <customer name="Erik"> <email address="erik@...
6
votes
2answers
409 views

How to write this SQL query for a XML type?

I am using SQL Server 2012 in which I have a table [abc] which has a column called [Information] of the [XML] type. This column has values like - <Information> <Groups> <...
0
votes
1answer
86 views

XML parsing failed in the sqlplus

I get following error when executing the query Invalid token in '[count(../[name(../)=name(.)])=count(../) and count(../*)>1' However when installing the Itstar_xml_util package, it asks for two ...
1
vote
1answer
489 views

sql server query execution plan via jdbc driver

is there a way to fetch the XML generated by the "Actual Execution Plan" in SQL server 2012 - 2014, but via JDBC driver for Java -- sqljdbc_6.0.8112.100_enu? (preferable forward compatible with 2016) ...
0
votes
1answer
41 views

MAX Query returns set results when using dbmail

I am setting up alerts in a system and I want to query a db table and get the max date passed in to a data row and only that one entry. For some reason, when I do it, the HTML email that comes ...
2
votes
1answer
103 views

Can a Selective XML index help when using query()?

Say I have the following SQL query to work with Select myxml.query( ' <go> {for $each in /This/Company/Department[1]/Role/Person return if ($each/Shoes/F[@C="9"]="657493742") then (<ID>{$...
1
vote
1answer
49 views

Compare value from xml node that contains decimal

I need to compare the values of two different XML nodes for a record stored on SQL Server 2014. Here is the contents of my XML column that I will be using: <Document> <PolicyId>0</...
1
vote
1answer
540 views

Performance of XML to Table Function in Stored Procedures

In a number of the databases I'm helping to maintain, there is a pattern where the code passes in a list of IDs as an XML string to a stored procedure. A user-defined function turns them into a table ...
0
votes
3answers
2k views

Dynamic conversion of long data to wide with multiple columns

I'm trying to convert long data: ID|SchoolID|Section|RepScore|SportsScore|PartyScore 1 |20 |1 |23.2 |70.2 |42.3 2 |20 |6 |65.2 |75.8 |52.3 ...