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
3
votes
1 answer

Extracting Values From Two-Level XML List Into SQL Column

I have an SQL server 2008 database from which I am extracting multiple values from various tables to put into a single table. Among these values is some data pulled from XML that until recently was stored on a single level like so:
Justin RLA
  • 33
  • 1
  • 4
3
votes
2 answers

Inserting into SQL using an OpenXml

Hi I am trying to insert data into an SQL Server Database using an XML file which has some data as follows.I was able to do the attribute mapping in OPENXML.If i try to pass the XML as elements instead of attributes i get an error regarding the…
Developer
  • 231
  • 4
  • 19
3
votes
2 answers

add column value to an xml field as an attribute

I would like to add an attribute value to an xml field in a query. my example is below declare @table table (bookid int,xmlCol xml) insert into @table select 1, '
user829982
  • 121
  • 1
  • 2
  • 8
3
votes
1 answer

XML parsing: line 1, character 7, semicolon expected

An error occurs when running this XML SQL in C#. What is missing? It works fine in SQL Server management studio but not in the c#. protected DataTable ServiceCodes(string orderColumn = default(string), bool orderAscending = true) { string sql =…
Steve
  • 75
  • 1
  • 1
  • 8
3
votes
3 answers

SQL Server Update Value XML Node

I have 2 tables in SQL Server Table1 ID - Name - Phone 1 HK 999 2 RK 888 3 SK 777 4 PK 666 Table2 ID - XMLCol 1 XMLVal1 XMLVal1 1
user2561997
  • 443
  • 1
  • 6
  • 18
3
votes
2 answers

SQL server : How to seperate XML nodes in different rows

I have three column in my table with one column of XML type. I want to show different nodes of the XML data in different rows. Like, Col1 Col2 Col3 12 ABC
CODError
  • 779
  • 2
  • 10
  • 25
3
votes
1 answer

TSQL: How do I do a self-join in XML to get a nested document?

I have a SQL Server 2005 table like this: create table Taxonomy( CategoryId integer primary key, ParentCategoryId integer references Taxonomy(CategoryId), CategoryDescription varchar(50) ) with data looking…
Danimal
  • 7,672
  • 8
  • 47
  • 57
3
votes
4 answers

rank over shredded xml

Given the following sample of XML and the select statement that shreds the xml into a relation, what I need is the second column of the select to be the ordinal of the category (ie 1 for the directions and 2 for the colours in this case). Note: The…
Ralph Shillington
  • 20,718
  • 23
  • 91
  • 154
3
votes
2 answers

Cross Apply to get child parent value from Xml in SQL Server

I have the following XML: Jon David Mike Nil Pollard …
Paresh
  • 39
  • 1
  • 1
  • 2
3
votes
2 answers

Bulk load XML referring to auto-increment parent-id

In short: I want to do an XML Bulk Load to a SQL Server (2008) database and generate auto-increment-id's for a parent, that can be used in the child. This seems limited by the scope: the parent-node is not finished, so not inserted yet. Does…
Yahoo Serious
  • 3,728
  • 1
  • 33
  • 37
3
votes
3 answers

Oracle SQL XML Functions - How to get encoding in XML Prolog?

This SQL SELECT XMLRoot(XMLType('143598'), VERSION '1.0', STANDALONE YES) AS xmlroot FROM DUAL; generates an output as follows XMLROOT --------------------------------------
jagamot
  • 5,348
  • 18
  • 59
  • 96
3
votes
1 answer

SQL - Fetch XML with an INNER JOIN, modifying the XML

I have a table in SQL Server 2008 that stores XML data in an XML column. A typical XML fragment is: [...etc...] What I'm…
Chris J
  • 30,688
  • 6
  • 69
  • 111
3
votes
3 answers

SQL multiple SELECT query with xmlagg function- Data not pulled in the required fashion

My data in Oracle is something like this NAME | DEP_VALUE | ID_DEP Amy 1 AA1234 Bob 2 BB4321 Clara 1 CC5678 Clara 2 CC7890 John 1 JJ6543 John 2 JJ7865 John 3 JJ7654 Tom …
Raghu
  • 1,141
  • 5
  • 20
  • 39
2
votes
1 answer

Stored procedure parameter with XML query in MSSQL gives "argument must be string literal"

I'm trying to query a table with a column which is xml data with the query and value functions. When using regular string literals it's all okay, but if I put that in a stored procedure and try to use variables it doesn't work. I suppose I'm not…
Patrick
  • 17,669
  • 6
  • 70
  • 85
2
votes
2 answers

How can I query SQL Server and generate XML with column names and values as attributes

I'm trying to figure out how to query a table that generates xml that looks like below: (this is a sample from the AdventureWorks database. I can get the column names as the elements easy enough, but is it possible to make both the column name and…
SumOfDavid
  • 281
  • 4
  • 13