Questions tagged [xml]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
28 views

Export query result to Oracle Server

I have written PL/SQL code to store XML into cursor. Refer the below code Requirement: As of line at line 83, I am inserting the result into another table (XML_GEN) as XMLTYPE datatype. Line: insert ...
user3792741's user avatar
2 votes
1 answer
109 views

How does the XML_COMPRESSION option work?

XML_COMPRESSION has recently gone GA in Azure SQL Database I've been trying to find some details about how it works to understand the pros and cons and so far not found any specifics. Trying the below ...
Martin Smith's user avatar
  • 83.1k
2 votes
1 answer
134 views

Converting VARCHAR to XML with a size restriction

I have a query that needs to return text as valid XML. I also need to restrict the length of the text to a specific number of characters. I adapted a function that performs the conversion and outputs ...
user3748557's user avatar
0 votes
1 answer
56 views

Generate XML for each group in the table

I have the below data which I need to group with buid, duid and aid INSERT INTO XmlTable (id, cid, aid, buid, duid) VALUES(624220, 68487905, 33, '77D8B242', 'DF6DC7D0') ,(625475, 68487905, 33, '...
Himanshuman's user avatar
-1 votes
1 answer
67 views

XML Reader Performance

I am trying to optimize a query and it seems that this code, specifically the XML Reader is causing the issue. insert into #temp1 (Items, ApplicationId) select distinct convert(varchar(2000),z.query('....
A_Arnold's user avatar
  • 115
1 vote
1 answer
53 views

How to get more then one concatenated column from table rows

Below is a code i use now. In real life @stab table is big (and it is normal table not variable) and there are many concatenated columns, not only 2. I wonder is there any better solution than I use ...
Look's user avatar
  • 13
2 votes
2 answers
530 views

XML datatype instance has too many levels of nested nodes. Maximum allowed depth is 128 levels

This is the error message I get when running the query below: Msg 6335, Level 16, State 102, Line 43 XML datatype instance has too many levels of nested nodes. Maximum allowed depth is 128 levels. ...
Marcello Miorelli's user avatar
0 votes
1 answer
53 views

SQL: Count number of distinct records based on attribute value in an xml

Say I have following xml <Operations> <Info Id="2265" cId="2" aId="5" /> <Info Id="2266" cId="2" aId="5" /> <Info ...
Himanshuman's user avatar
2 votes
2 answers
235 views

Can't read data out of XML stored in table column

I have some data stored in a table in XML format: <AccountTypes xmlns=""> <Id>1003</Id> <Id>2</Id> <Id>3</Id> <Id>1004</Id> &...
ChrisF's user avatar
  • 302
-1 votes
2 answers
381 views

XML data type cannot be compared or sorted

My source is in SQL server; my target is in Snowflake. The target table was created by extracting the XML column only from the source. I need to compare the first 20 rows in source and target to see ...
Jimbo's user avatar
  • 65
0 votes
1 answer
107 views

What is the best option to store XML in SQL Server 2016?

On SQL Server 2016 (13.0.6300.2) we have one table that have two XML columns and around 1 500 000 rows. Size of table is around 150 GB. What is the best option to compress this table ? I was checking ...
adam.g's user avatar
  • 283
3 votes
1 answer
159 views

XML vs UDF performance in SQL Server

I have a situation where I have to decide between receiving XML as an input parameter to the stored procedure or a list of comma separated values and parse them using a multi-table valued function. ...
lifeisajourney's user avatar
2 votes
1 answer
206 views

SQL Server XQuery Namepace

I'm trying to query an xml like below. <wfs:FeatureCollection xmlns:gml="http://www.opengis.net/gml" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis....
Sir Swears-a-lot's user avatar
8 votes
4 answers
657 views

Return Variable Number Of Attributes From XML As Comma Separated Values

over-extended In SQL Server Extended Events for the blocked process report and deadlock XML, it's possible to get multiple SQL Handle values back to identify queries involved in the raised event. ...
Erik Darling's user avatar
  • 38.3k
-1 votes
1 answer
432 views

SQL optimization for XML Path [duplicate]

SELECT distinct STUFF( (SELECT distinct ',' + hg.CODE FROM SP_HD hg Inner join Purchase.SP_DT on GOODS_RECEIPT_ID = hg.ID WHERE PO_DT_ID = d.PO_DT_ID FOR XML PATH(''), TYPE )....
Subin Benny's user avatar
0 votes
1 answer
157 views

Retrieve execution plan via XML data from sp_WhoIsActive in adhoc process

We have installed a process in which we execute the sp_WhoIsActive procedure every 1 minute. We combine some additional logic into the same job. Currently the sp_WhoIsActive procedure is run every 4-5 ...
adam.g's user avatar
  • 283
4 votes
1 answer
486 views

SQL Server execution XML plan cut off in length

I am running the following standard query to retrieve the XML execution plan for queries that I ran on my SQL Server via command line. SELECT pl.query_plan FROM sys.dm_exec_cached_plans ep CROSS APPLY ...
karmanaut's user avatar
  • 141
0 votes
1 answer
667 views

Loading Extended Events ring buffer to SQL table using powershell

I am running a RPC_Completed extended event which outputs to a ring buffer. While trying to read the data from the ring buffer target data, xQuery is taking too much of time. The faster route was to ...
Mobious's user avatar
  • 11
1 vote
1 answer
2k views

json_modify on condition

As in my previous question, I am working on migrating my XML based procedures to JSON ones. My newest struggle is with json_modify I'm used to using .modify with XPATH to be able to modify XMLs on the ...
Rushabh Mehta's user avatar
1 vote
1 answer
455 views

Enumerating JSON arrays with OPENJSON

I've been working on converting some of my XML based stored procedures to JSON, but I'm running into an issue. With OPENXML, I had access to mp:id, so when I was parsing an XML, I could access an ...
Rushabh Mehta's user avatar
1 vote
2 answers
73 views

Execution time/cost of function in assembly

I have a query calling XmlTransform from Microsoft.MasterDataServices.DataQuality on about 1000 rows or so and it takes 30s to do the whole set (the XSL is in a fixed variable), is there any way to ...
Cade Roux's user avatar
  • 6,612
0 votes
2 answers
206 views

like in exist() xml mssql

By following question: See if XML element exists at any level in document with a specific value Is there a possible solution to implement like clause within exist? For example I have similar structure ...
Fatdrfrog's user avatar
0 votes
1 answer
240 views

Merging two XML variables - please help!

I am using SQL Server Management Studio 17.9.1 with SQL Server 2016 Service Pack 2 (SP2). There is no table structure to show, just two XML variables that contain XML, as shown below: DECLARE @A XML = ...
UdarTenjin's user avatar
1 vote
0 answers
82 views

SQL Error 6304 - XML parsing: An unexpected error has occurred in the XML parser

I'm running SQL Server 2019 and not sure if it's related to this, but on SQL Server 2014 if I create a table as follows CREATE TABLE MyTable ( FieldA smallint NOT NULL, FieldB xml NOT NULL ) And ...
vaskitup's user avatar
0 votes
1 answer
75 views

Do we have information about duration time of query in actual execution plan?

I am building application in C# which is parsing Actual Execution Plan. I need basic stats like Row count, CPU time, Page Reads etc. All above stats I found in XML of Actual Execution Plan. I can not ...
grochu's user avatar
  • 45
7 votes
2 answers
780 views

SQL Server / XML.query() causes massive memory grant

The following (on my systems, tested on SQL Server 2016 and 2019 std) produces a massive memory grant request (3327 MB) declare @wibble xml = '<wibble><wobble>1</wobble></wibble&...
uberbloke's user avatar
  • 108
3 votes
1 answer
999 views

What are the benefits of using XML over CSV files in regards to data dumps? [closed]

Prologue I've noticed that one benefit of using CSV over XML for data dumps is the fact that fewer disk space is used. See minimal working example below. Let's suppose we have the following dataset. ...
rdrg109's user avatar
  • 131
3 votes
1 answer
310 views

Properly pivot an XML column with XQuery

I would like to pivot the attributes and values of an SQL XML column and display it in an ordered columns and rows format. To get started, this is what the XML column looks like in SQL: <Model ...
JF Landry's user avatar
5 votes
1 answer
3k views

Msg 6355 "Conversion of one or more characters from XML to target collation impossible" when querying sys.dm_exec_query_plan

I like to find missing indexes on the go, looking at the execution plans! It can potentially give me an indication where further to look at if I want to improve something that is currently running. ...
Marcello Miorelli's user avatar
1 vote
3 answers
650 views

How can parse column names using ordinal position (not name) from XML data in SQL Server?

I have several hundred tables in a database that have the same structure: SomeId, Pos, Varying Number of Other Fields So, for example, one table may look like this: PersonId, Pos, Hobby, Degree 12345, ...
Mike S's user avatar
  • 135
0 votes
0 answers
33 views

How should I deal with sub attributes of xml data when loading onto mysql?

I have some xml files (example below). As you can see in the xml, id 4 has 3 entries for tax. When I load it right now, only the last entry gets inserted into the table. How can I include all 3 of ...
scientific_explorer's user avatar
9 votes
2 answers
380 views

Why is SQL doing an index scan and seek with the same XML query structure?

I've set up a test to benchmark xml performance in SQL server. Test Setup One Million rows of data XML defined Column with primary key A primary XML index A secondary XML index on the path XML data ...
Middletone's user avatar
0 votes
0 answers
182 views

How to open .bin SQL database?

I'm stuck and not sure if somebody had a similar issue. I have an old database stored as .bin files. It dates back to 2012. I can see an xml catalogue file which indicates to me that it is some kind ...
Ali Nato's user avatar
0 votes
1 answer
354 views

sqlserver - Insert from xml generated with `select for xml`

Is there a simple way to create an XML (file, variable, value in column, whatever) with select * from table for xml ... and later automatically insert this data into identical table in different ...
Jędrzej Dudkiewicz's user avatar
2 votes
0 answers
1k views

EAV vs JSON/XML column approach to store complex user form data in a database? [closed]

We are working on an internal tool which will essentially be a complex, power-user oriented form app. It is not a dynamic field app - users can't define their own fields. Form field types: The form ...
merfi's user avatar
  • 166
6 votes
1 answer
1k views

OPENXML to get content by using element and attribute name

In this SQL Server OPENXML example: declare @xmldata xml set @xmldata = '<?xml version="1.0"?> <wddxPacket version="1.0"> <data> <var ...
FlanMan's user avatar
  • 163
0 votes
1 answer
185 views

Get the last ID from Multiple Stored Procedures Executed

So I have an XML file , to take data from it and insert into tables. For this I’ve created 3 procedures(INSERTXMLMultipleTables,INSERTXMLNIAC,INSERTNIACFORCOMPONENTS). The logic of these procedure is ...
dan morcov's user avatar
7 votes
4 answers
9k views

Error converting VARCHAR(MAX) to XML due to "UTF-8" attribute

I need to dig into a logs table with a schema similar to this: CREATE TABLE t ( id int PRIMARY KEY, data varchar(max) ); Column data stores a XML text received from a web service in this format: ...
McNets's user avatar
  • 23.5k
3 votes
1 answer
418 views

Mix ;WITH NAMESPACES and schema collections?

I'm getting these xml files from a vendor, and it's a wrapper of NITF (news) schema and the http://www.xmlnews.org/namespaces/meta# news metadata schema (from Space 1999!) Unfortunately, they don't ...
user1664043's user avatar
3 votes
1 answer
144 views

Can you create a primary xml index in the CREATE TABLE statement (SQL Server)?

I'm creating a temporary table and would like to create a primary and secondary XML index on a contained xml column within the CREATE TABLE statement since that is the only way I can create an index ...
mwigdahl's user avatar
  • 263
0 votes
3 answers
991 views

How to allow for ampersand in XMLtable()?

Starting with this Q&A, note that while this works: with data as ( select 'Hallöle sloven&#264;ina Hallöle sloven&#273;ina' str from dual ) select a.str, b.str2 from data a, xmltable( '/...
nutty about natty's user avatar
3 votes
2 answers
1k views

How to convert xml entities to unicode characters (with read-only access) in Oracle?

I'm connected to an Oracle Database (11g Release 2 - 11.2.0.4), with read-only access. Into this database, some of the data is uploaded via, or rather as, XML - and quite a few entries contain ...
nutty about natty's user avatar
3 votes
1 answer
957 views

How to add Spatial Reference ID 28992 to MSSQL server?

I want to use Spatial Reference ID 28992, as found on EPSG, in MS SQL Server. How can I add this to MS SQL Server? My end goal is to get this dataset into MS SQL Server, with the Geography Markup ...
Jens Wagemaker's user avatar
0 votes
1 answer
157 views

SQL Server Deadlock OPENXML insert

I am running into a deadlock issue when I call a stored procedure in Sql Server 2014 Enterprise Edition. An XML string is passed into the stored procedure and can be called many times in quick ...
Adrye's user avatar
  • 1
3 votes
0 answers
398 views

Why does sql server consider a function that extracts a value from an xml parameter non-deterministic?

I want to add a computed field that extracts a value from another xml column. The function looks like this: create or alter function extractValue(@val xml) returns varchar(14) as begin return @val....
boggy's user avatar
  • 427
0 votes
1 answer
423 views

does xml element exist, regardless of value?

EDIT: I demonstrated my ignorance by confusing attribute with element, I updated my question. Sorry. To clarify, I'm looking for the existence of the element code in: <conditionmessage:code>...
Lennart - Slava Ukraini's user avatar
2 votes
1 answer
462 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
91 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
4k 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
556 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

1
2 3 4 5
8