All Questions

Tagged with
Filter by
Sorted by
Tagged with
0
votes
1answer
37 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 ...
8
votes
3answers
165 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('(/...
2
votes
1answer
54 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 ...
6
votes
2answers
498 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
40 views

Special letter behaviour problem?

I asked question in very blurry manner because I cannot explain in short sentence what is my problem about. In general I have a set of procedures which transforms text and XML. Inside the procedures ...
3
votes
3answers
1k views

Why is XML taking up more storage than VARCHAR(MAX)?

We have large tables storing XML data as varchar(MAX). The data is for reference/historical purposes, it's not queried. Based on what I've read, storing as XML datatype instead of VARCHAR(MAX) should ...
1
vote
1answer
192 views

Update XML metadata in SQL Server

I'm trying to change the value in the XML metadata using SQL Server. The XML file looks like this: <Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/...
-2
votes
2answers
325 views

Extract hierarchical data from XML

I have a table: CREATE TABLE [Course].[Navigation]( [NavigationId] [int] IDENTITY(1,1) NOT NULL, ParentID int, ChildID int, [Type] [varchar](100) NULL, [Label] [int] NULL, [...
4
votes
1answer
2k views

Read system_health event_file instead of ring_buffer for deadlocks extended events

I'm currently using this disaster to locate recent deadlocks by reading the system_health Extended Events ring buffer. select top 2000000000 XEvent.value('@timestamp', 'datetime2(3)') as ...
3
votes
2answers
2k views

Why store XML Schema in SQL Server 2012 database?

What a real world production environment example for storing and or using a XML schema in a SQL Server database? I am working my way though the Microsoft 70-461 exam objectives. I have completed ...
1
vote
1answer
606 views

Identifying Execution Plans with Probe Residual

I am trying to find out Execution Plans that has Probe Residual. Need to know the following Which physical and logical operator has this Probe Residual What is the Cost% of that operator in the ...
0
votes
1answer
2k views

How to create xml from sql table?

I have sql table from which I am trying to get results based on some criteria as: From above table I want to create xml which has to return result as: Here is the query I have written for the ...
2
votes
1answer
1k views

Create an XML Schema collection in SQL Server 2012?

I want to create an XML schema collection to validate some XML in a column for the following XML: DECLARE @xml as xml SET @xml=' <R C="firstName" O="" N="Fred" /> <R C="lastName" O="" N=...
3
votes
1answer
1k views

How to script XML Schema collection in SQL Server 2012?

I need to make script of XML schema collections in my Database and then insert each xml inside a table field as string. I need to do this to compare current schema collections with the new schema ...
1
vote
3answers
11k views

SQL Server Select in XML field

I need a help with the situation below: In my table SQLServer 2012 have a field with xml values, I would like to make a select of the data in that field and show the result in the form columns. <...
3
votes
1answer
2k views

How to resolve this 'XML Validation: Declaration not found for element' error?

I'm new to SQL Server and I have this task to complete (for learning purposes), yet I'm unable to figure out this error due to inexperience with XML Schemas (I think) Here's what I'm trying to do - ...
3
votes
1answer
129 views

Help with SQL Server and XML columns

I am writing a query to run against the SCOM 2012 OperationsManager database. SQL instance is Microsoft SQL Server 2012 - 11.0.5058.0 (X64). Within the database is a table called Monitors. The schema ...
2
votes
2answers
2k views

Is there a way to validate XML using variable as schema?

Is there a way to declare XSD schema as variable inside a construct: DECLARE @xml XML(Books)? I need to make quick validation of XML using XSD schema which is declared as variable. I suppose there is ...
1
vote
1answer
820 views

Why SQL function always returning empty result set?

Following function I have write which accept xml and returns table as result. CREATE FUNCTION FunctionTest(@ID INT,@XML_Details xml) RETURNS @RESULT TABLE ( Value1 INT, Value2 INT ) AS BEGIN ...
32
votes
1answer
4k views

Very strange performance with an XML index

My question is based on this: https://stackoverflow.com/q/35575990/5089204 To give an answer there I did the following test-scenario. Test scenario First I create a test table and fill it with 100....
4
votes
1answer
2k views

SQL 2012 CLR error: “The context transaction which was active before entering …”?

I am experience strange error with SQL 2012 and CLR: The context transaction which was active before entering user defined routine, trigger or aggregate "My routine" has been ended inside of it,...
3
votes
1answer
7k views

How to read multiple record from xml to insert in table in SQL?

DECLARE @tbl_XMLResult table ( Status varchar(50), Address varchar(100), ListPrice varchar(25), SoldPrice varchar(25), YearBuilt varchar(25), SF varchar(25), Acres varchar(...
0
votes
1answer
1k views

How to read and process xml data from stored procedure in sql server?

I am calling a stored procedure like this: usp_ReportResults @query = '759,905,1048,170,725,80129', @ReportName = 'GenRepot' where usp_ReportResult is defined as CREATE PROCEDURE ...
7
votes
1answer
1k views

How to better use CLR Function from performance point of view (repeat inside each DB or have general function)?

I asked a question about validation of XML using XSD schema inside SQL Server 2012 (see link). I understand (as I suspected) that I need to use CLR Function. The function will get XSD schema text and ...
5
votes
1answer
706 views

Validate XML using XSD inside TSQL function in SQL Server 2012?

I need to validate XML using XSD inside TSQL. To make this task semi automated I need to do this inside TSQL function. To make validation I have to set value to XML and if it is not valid I will ...
4
votes
2answers
9k views

Parsing Typed XML with a default namespace and inconsistent root node

I have a structured, typed xml file. <WebService xmlns="http://www.orbis-software.com/WebSvcCon"> <NewLeads> <OutputSchema> <root xmlns="" type="array"> <item type="...
2
votes
1answer
287 views

View created from XML data - Statistics

I am looking at a legacy system that stores XML blobs A view is created over this so the data is more accessible (for reporting) CREATE view [dbo].[Data] as select top 100 percent data.value('(/...
5
votes
2answers
3k views

Import XML files into SQL Server 2012

Every Friday I have to import a couple (sometimes more than 300) of XML files into 2 tables. The structure of one of the tables, R000000, looks like this: R00000010 | R00000020 | R00000030 | ...
1
vote
1answer
90 views

putting together contents of XML column - from all rows of a table - how to get it done without a “while”?

I have a table called sizeguide with the definition you can see below. I am interested in the SizeGuideXML column, which is type XML. I had a mission the objective was, for each SizeGuideDesc, get ...
3
votes
2answers
81 views

Shreded system_health ExEvent not returning all node information

SQL Server is not returning all node information when I shred the deadlock XML from the 2012 system_health Extended event. When I run the following query SELECT CAST(event_data.value('(event/data/...
12
votes
1answer
480 views

Why is the secondary selective index not used when the where clause filters on `value()`?

Setup: create table dbo.T ( ID int identity primary key, XMLDoc xml not null ); insert into dbo.T(XMLDoc) select ( select N.Number for xml path(''), type ) from ( ...
3
votes
1answer
552 views

Create Nested XML in a Sql Server Indexed (Materialized) View

This page https://msdn.microsoft.com/en-us/library/ms188276.aspx indicates that if you wanted nested XML (ie an XML Tree) then you need to setup your query like this: SELECT Col1, Col2, ...
1
vote
1answer
132 views

how to output 3 column into 3 element in xml format with the same name?

I have this code and I can't figure out how to get the expected result? declare @table table (TAG int, PARENT int,col1 varchar(100) ,col2 varchar(100) ...
2
votes
2answers
1k views

Possible to optimize SELECT query involving XQuery functions selecting from elements with arbitrary number of child elements

Suppose I have the following XML data, where <root> can have an arbitrary number of <child> children <child> can have an arbitrary number of <grandchild> children <...
8
votes
1answer
57k views

Simplest way to edit single entry in XML column?

As I understand MS SQL Server Management Studio doesn't allow directly editing/replacing entries in XML columns via GUI (copy/paste doesn't work etc.). What is the easiest option to replace a single ...
3
votes
2answers
19k views

Trigger to audit table changes

I have created a trigger to audit changes to a table: CREATE TRIGGER [dbo].[iudt_AutoAuditChanges] ON dbo.CPTCategoryMaster AFTER INSERT,DELETE,UPDATE AS BEGIN SET NOCOUNT ON; ...
17
votes
2answers
132k views

Converting a VARCHAR to VARBINARY

I've been keeping a log of expensive running queries, along with their query plans, in a table to allow us to monitor trends in performance and identify areas that need optimising. However, it's come ...
0
votes
1answer
87 views

XML Network Call to Application from SQL Server 2005

We don't really have a DBA here, just a semi-experienced SQL Developer and me. I've only got about a year's experience myself and we're the only programmers for our small business. We're trying to ...
4
votes
0answers
572 views

SQL Server 2012 Error when creating Selective XML Index on XML Query Plan

I'm trying to create a database solution that will enable me to optimise high CPU/IO/Duration queries to improve overall performance of the database. Part of the optimisation requires persisting ...
3
votes
1answer
90 views

What is the difference between node types and atomic types in XML

Im Studying TSQL and I came to the chapter regarding XML, and here a question that I cannot find an answer: "What is the difference between node types and atomic types"? Thank you!
4
votes
1answer
699 views

Sql Server 2012 Extended Events for Selective Xml Indexing not showing results

I created a Extended Event to monitor and tune a Selective Xml Index CREATE EVENT SESSION [SelectiveXmlIndexing] ON SERVER ADD EVENT sqlserver.selective_xml_index_no_compatible_sql_type, ADD EVENT ...
33
votes
2answers
13k views

Optimising plans with XML readers

Executing the query from here to pull the deadlock events out of the default extended events session SELECT CAST ( REPLACE ( REPLACE ( XEventData.XEvent.value ('(data/value)[...