Refactoring and static code analysis tool for SQL Server
Got a SQL Server or .NET question? Discuss it in the forums. (SQL Server Forums | Dot NET Forums)
First Time? You can support us by signing up. It takes only 5 seconds. Click here to sign up. If you already have an account, click here to login.

How to generate CDATA and NAMESPACE Declarations using FOR XML EXPLICIT

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...

FOR XML EXPLICIT Tutorial – Part 4

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...

Another XML Shaping Example - using FOR XML PATH and EXPLICIT

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...

FOR XML EXPLICIT Tutorial – Part 3

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...

FOR XML EXPLICIT Tutorial - Part 2

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'...

FOR XML EXPLICIT Tutorial- Part 1

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...

Copyright © Beyondrelational.com