Browse by Tags
All Tags »
FOR-XML-EXPLICIT (
RSS)
I was asked this question in one of the SQL Server forums recently. The OP wanted to generate an XML document with CDATA sections and NAMESPACE declarations. SQL Server 2005 introduced WITH XMLNAMESPACES() which is very handy to generate namespace declarations...
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...
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...