Questions tagged [sqlxml]

SQLXML is a feature in MS SQL (introduced in SQL Server 2000), that enables XML support for making queries and processing data.

SQLXML was introduced in MS SQL Server 2000, and adds support for MSXML library into SQL Server. It allows the user to execute SQL SELECT statements that return XML instead of tabular data. In later versions(from SQL Server 2005), the XML support was extended with adding xml as a type in MS SQL Server to support XPath and XQuery over tables.

More info can be found in SQLXML's page in MSDN: http://msdn.microsoft.com/en-us/library/aa286527.aspx

471 questions
105
votes
4 answers

How to query for Xml values and attributes from table in SQL Server?

I have a table that contains a Xml column: SELECT * FROM Sqm A sample of the xml data of a row would be:
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
30
votes
4 answers

How to query values from xml nodes?

i have a table that contains an XML column: CREATE TABLE Batches( BatchID int, RawXml xml ) The xml contains items such as:
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
19
votes
1 answer

SQL UNION FOR XML name output column

I'm trying to generate an XML output from SQL and need to use a UNION statement and also name the output column. I had this working before when I didn't need to use a UNION statement using: select( SELECT [CompanyName], [Address1], …
Jammer
  • 2,330
  • 11
  • 48
  • 77
17
votes
2 answers

SQLXML without XML encoding?

I'm using a generic system for reporting which takes data from a database view (SQL Server 2005). In this view I had to merge data from one-to-many relations in one row and used the solution described by priyanka.sarkar in this thread: Combine…
Koen
  • 3,626
  • 1
  • 34
  • 55
14
votes
2 answers

cross apply xml query performs exponentially worse as xml document grows

What I Have I have a variable size XML document that needs to be parsed on MSSQL 2008 R2 that looks like this:
James L.
  • 9,384
  • 5
  • 38
  • 77
11
votes
3 answers

XML output from MySQL query

is there any chance of getting the output from a MySQL query directly to XML? Im referring to something like MSSQL has with SQL-XML plugin, for example: SELECT * FROM table WHERE 1 FOR XML AUTO returns text (or xml data type in MSSQL to be precise)…
NumberFour
  • 3,551
  • 8
  • 48
  • 72
10
votes
2 answers

SQL Server - returning xml child nodes for xml column

Given table T with columns: ID UNIQUEIDENTIFIER CreatedDate DATETIME XmlData XML Where XmlData is structured like:
statement
Paul Fleming
  • 24,238
  • 8
  • 76
  • 113
9
votes
2 answers

Ignore XML namespace in T-SQL

How do I remove/ignore the XML namespace in an xml file when querying the data with T-SQL? I’m loading an xml file into a variable, and it works just fine. But the xml has a namespace set, and unless I remove it, my queries come up…
Jakob Gade
  • 12,319
  • 15
  • 70
  • 118
9
votes
2 answers

XML data type method “value” must be a string literal

How to change my query so that this error doesn't happen: XML data type method “value” must be a string literal T-SQL code: Declare @Count Int = 1 While(@count <= @j) Begin insert into mytable ([Word]) Select…
nona dana
  • 111
  • 1
  • 2
  • 4
7
votes
1 answer

SQLXML Bulk loading an attribute into a single table

TLDR; I am attempting to use SQLXML Bulk Loader (4.0) to load XML that looks something like this; 3 John Smith3
n00b
  • 4,341
  • 5
  • 31
  • 57
7
votes
1 answer

SQL : Find if XML node exists

Assuming I have a table data as below: I want to Select all Value(XML Data) which contains the node Name="Hello World". How can I achieve it? SQL Fiddle set @f = @XML.exist('/ArrayOfFilterColumn/SelectColumn[(@Name) eq "Hello World"]'); select…
Gun.IO
  • 173
  • 1
  • 1
  • 9
7
votes
1 answer

SQL Server : FOR XML sorting control by attribute

I am generating a XML file from a SQL Server query. I have some problem about sorting elements issues. For example, there is simple code as below. As you can see…
clear.choi
  • 835
  • 2
  • 6
  • 19
7
votes
2 answers

Creating XML with SQL Server

I have a table with the data: itemID itemLocation quantity ------------------------------------------------------- B008KZK44E COMMITED 1 B008KZK44E PRIME 1 B008KZK2LE COMMITED 1 I need to generate an xml with this node…
user2867895
  • 73
  • 1
  • 1
  • 3
7
votes
1 answer

Concatenating xml values when selecting by XQuery in T-SQL

This is my sample XML: value1 value2 And this is my test query: DECLARE…
sdds
  • 2,021
  • 2
  • 25
  • 33
7
votes
2 answers

SQL Server: Two-level GROUP BY with XML output

I have a table of hierarchical data that I am trying to select as a single, grouped XML value: Columns: Id, Type, SubType, SubSubType Sample data: Id Type Subtype SubSubType 1 Product Documentation …
gice
  • 95
  • 1
  • 1
  • 7
1
2 3
31 32