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
6
votes
2 answers

Does SQLXML breaks 1NF?

I see that Oracle, DB2 and SQL Server contain a new column XML. I'm developing using DB2 and from a database design you can break the 1NF if the xml contains a list. Am I wrong to assume that SQLXML can break 1NF ? Thank you,
dalcorta
  • 85
  • 4
6
votes
3 answers

how do I select records that are like some string for any column in a table?

I know that I can search for a term in one column in a table in t-sql by using like %termToFind%. And I know I can get all columns in a table with this: SELECT * FROM MyDataBaseName.INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME =…
bernie2436
  • 22,841
  • 49
  • 151
  • 244
5
votes
2 answers

TSQL FOR XML EXPLICIT

Not able to to get the desired XML output The following: SELECT 1 as Tag, 0 as Parent, sID as [Document!1!sID], docID as [Document!1!docID], null as [To!2!value] FROM docSVsys with…
paparazzo
  • 44,497
  • 23
  • 105
  • 176
5
votes
1 answer

How can I use sp_xml_preparedocument on result of NTEXT query in SQL 2000?

I know NTEXT is going away and that there are larger best-practices issues here (like storing XML in an NTEXT column), but I have a table containing XML from which I need to pluck a attribute value. This should be easy to do using…
flipdoubt
  • 13,897
  • 15
  • 64
  • 96
5
votes
2 answers

T-SQL, Load XML data into a local variable

I would like to know, how can I load the XML content from an arbitrary file into a local variable? This works for a fixed file: DECLARE @xml XML SET @xml = ( SELECT * FROM OPENROWSET(BULK 'C:\data.xml', SINGLE_BLOB) AS data ) However, I would…
Eric
  • 1,321
  • 2
  • 15
  • 30
5
votes
2 answers

Get XML element name and the attribute value using SQL XPATH query

Given an XML type string such as declare @xml xml SET @xml = ' 10.00 2013 CallVendor
rguy
  • 125
  • 1
  • 7
5
votes
1 answer

SQL 2012 - iterate through an XML list (better alternative to a WHILE loop)

Using SQL 2012 & getting XML passed into a stored procedure that must take that input & write a row to the table for each of the items that is in a section of the XML that is passed to the stored procedure. The XML looks like: My…
steve_o
  • 1,243
  • 6
  • 34
  • 60
5
votes
2 answers

How to concatenate data from a SQL Server XML query?

I have a SQL query that returns me the XML below electronics 0x58 phones
dezzy
  • 479
  • 6
  • 18
5
votes
3 answers

Using SQL to query an XML data column

I'm having issues querying XML data stored in a SQL Server 2012 database. The node tree I wish to query is in the following format -
StuartO
  • 53
  • 1
  • 1
  • 4
5
votes
5 answers

How to return XML from SQL Server 2008 that is structured with multiple selections sharing a common parent

I've tried using "FOR XML PATH", "FOR XML EXPLICIT" and "FOR XML AUTO" but the data is never structured with the correct heirarchy. Basically, I have one parent table (Customers) and 3 child tables. Each table has a customerid column. There is a…
Matt
  • 195
  • 1
  • 4
  • 12
4
votes
2 answers

How do I return a single XML attribute from an XML document in SQL Server?

I am just trying to get the JobID attribute from some XML using the following script. Is there a better way to do this? PROCEDURE [dbo].[spProcessJobXML] @XMLPACKET as nvarchar(MAX) -- AS -- Declare XML doc…
nomi
  • 431
  • 1
  • 5
  • 12
4
votes
3 answers

SqlDataReader are these two the same Which one is faster

I am working with SqlXml and the stored procedure that returns a xml rather than raw data. How does one actually read the data when returned is a xml and does not know about the column names. I used the below versions and have heard getting data…
Deeptechtons
  • 10,945
  • 27
  • 96
  • 178
4
votes
3 answers

SQL Select FOR XML into Solr document

I'm trying to get a SQL select statement to generate XML which conforms to the Solr standard. Given a table like: id | name --------- 1 | one 2 | two 3 | three I need a result which is like (with or without the root node):
STW
  • 44,917
  • 17
  • 105
  • 161
4
votes
2 answers

LINQ to SQL - Xml Field Problem - How low down can you intercept the generated TSQL?

Our development stumbled onto a major roadblock in terms of Linq to Sql and Sql 2005+ Xml Fields. We have an Xml blob field containing fields... To leverage LINQ to SQL, we created a UDF in…
Terry
  • 2,148
  • 2
  • 32
  • 53
4
votes
1 answer

MSSQL XML Performance Issue

Sample Data:
Paul Becker
  • 123
  • 7
1
2
3
31 32