Browse by Tags

All Tags » FOR_XML_PATH (RSS)
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 ...
Posted by Jacob Sebastian | with no comments
Filed under: ,
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...
Posted by Jacob Sebastian | with no comments
Filed under: ,
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...
Posted by Jacob Sebastian | with no comments
Filed under: ,
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...