Browse by Tags
All Tags »
FOR_XML (
RSS)
This article demonstrates how to generate an RSS 2.0 feed with iTunes extension using TSQL. It presents two version of the TSQL query, one using FOR XML PATH and the other FOR XML EXPLICIT. ...
After reading the XQuery Labs many people asked me if I could build such a resource page for articles that explains the usage of FOR XML. Here is a list of short articles I have previously published. I will keep updating this page as and when new articles...
One of my readers recently contacted me with an XML shaping requirement. He wanted to generate an XML document with a specific structure from a result set that he has created. Here is the source data. RootNode ParentNode Node Name Number Valid Value ...
Continued from FOR XML EXPLICIT Tutorial – Part 3 This is a late addition to the 3 part FOR XML TUTORIAL I wrote last year. You can find Part 1 here , Part 2 here and Part 3 here . When generating the XML document, FOR XML EXPLICIT processes rows in the...
We discussed FOR XML in a number of previous posts. SQL Server 2005 added a few enhancements to the FOR XML clause. One of the enhancements added in SQL Server 2005 is the PATH clause which helps to do a great deal of customization/control over the structure...
When you generate an XML document using FOR XML, columns having NULL value will be eliminated. Some times you might need to have an empty element (even if there is no value) generated to make sure that the application that processes the XML document does...
One of the two common string operations that we do often are 'parsing' delimited strings and 'generating' delimited strings. This post explains how to generate a delimited string using FOR XML. I like XML and many of you might have noted...
When you write a simple FOR XML query with PATH, you will see that a <row> element will be generated for each row in the result set. For example: DECLARE @t TABLE (Name VARCHAR (10)) INSERT INTO @t (Name) SELECT 'Jacob' INSERT INTO @t (Name...
XML Workshop - A series of XML articles published at www.sqlservercentral.com XML Workshop I - Generating XML with FOR XML - A short article that explains how to generate XML output with TSQL keyword FOR XML with AUTO and RAW directives XML Workshop...
In many of the previous posts, we discussed about controlling the structure of the XML being generated with FOR XML. SQL Server 2005 introduced the PATH operator which provides a great extend of control over the shaping of the XML being generated. With...
Continued from FOR XML EXPLICIT Tutorial - Part 2 Having fixed the problem with the sort order, let us go ahead with the rest of the code. Let us add Addresses under the AddressCollection node and come up with the final version of the code. We need to...
Continued from FOR XML EXPLICIT Tutorial- Part 1 Let us move ahead. Under each agent, we need a node named AddressCollection . Let us add the code for that. SELECT 1 AS Tag, NULL AS Parent, NULL AS 'Agents!1!' , NULL AS 'Agent!2!AgentID'...
With SQL Server 2005 we can generate XML output using different methods. Using TSQL keyword FOR XML along with AUTO, RAW, PATH and EXPLICIT we could generate almost any XML structure that we might need. PATH is a very powerful keyword which allows a great...