<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>XML on AdaTheDev Blog</title><link>https://www.adathedev.co.uk/tags/xml/</link><description>Recent content in XML on AdaTheDev Blog</description><generator>Hugo -- gohugo.io</generator><managingEditor>adathedev@gmail.com (Adrian Hills)</managingEditor><webMaster>adathedev@gmail.com (Adrian Hills)</webMaster><lastBuildDate>Mon, 16 Jan 2012 10:36:00 +0000</lastBuildDate><atom:link href="https://www.adathedev.co.uk/tags/xml/index.xml" rel="self" type="application/rss+xml"/><item><title>Excluding nodes from XML data before returning from SQL Server</title><link>https://www.adathedev.co.uk/2012/01/modifying-xml-data-before-returning.html</link><pubDate>Mon, 16 Jan 2012 10:36:00 +0000</pubDate><author>adathedev@gmail.com (Adrian Hills)</author><guid>https://www.adathedev.co.uk/2012/01/modifying-xml-data-before-returning.html</guid><description>This post follows on from a question I recently replied to, for how to exclude a specific node from an XML column value before returning it, using TSQL.
Example setup CREATE TABLE Example ( ID INTEGER IDENTITY(1,1) PRIMARY KEY, XmlField XML ) INSERT Example (XmlField) VALUES (&amp;#39;&amp;lt;Root&amp;gt;&amp;lt;ChildA&amp;gt;Value I want to see&amp;lt;/ChildA&amp;gt;&amp;lt;ChildB&amp;gt;Value I do not want to see&amp;lt;/ChildB&amp;gt;&amp;lt;/Root&amp;gt;&amp;#39;) So if you want to return the XML minus the ChildB node, how do you do it?</description></item><item><title>SQL Server XML datatype with CDATA</title><link>https://www.adathedev.co.uk/2010/06/sql-server-xml-datatype-with-cdata.html</link><pubDate>Mon, 14 Jun 2010 14:06:00 +0100</pubDate><author>adathedev@gmail.com (Adrian Hills)</author><guid>https://www.adathedev.co.uk/2010/06/sql-server-xml-datatype-with-cdata.html</guid><description>So today I learnt something new - it turns out the XML datatype in SQL Server does not preserve CDATA sections.
e.g.
DECLARE @XML XML SET @XML = &amp;#39;&amp;lt;Test&amp;gt;&amp;lt;NodeA&amp;gt;&amp;lt;![CDATA[Testing cdata section &amp;lt;woop!&amp;gt;]]&amp;gt;&amp;lt;/NodeA&amp;gt;&amp;lt;/Test&amp;gt;&amp;#39; SELECT @XML Results ------------------------------------------------------------------ &amp;lt;Test&amp;gt;&amp;lt;NodeA&amp;gt;Testing cdata section &amp;amp;lt;woop!&amp;amp;gt;&amp;lt;/NodeA&amp;gt;&amp;lt;/Test&amp;gt; After a quick dig around, I found this MS Connect case. I personally would like to see it accept whatever you pass in without silently altering it, as long as it&amp;rsquo;s well-formed XML of course.</description></item><item><title>SQL Server 2008 - Table Valued Parameters vs XML vs CSV</title><link>https://www.adathedev.co.uk/2010/02/sql-server-2008-table-valued-parameters.html</link><pubDate>Thu, 11 Feb 2010 20:38:00 +0000</pubDate><author>adathedev@gmail.com (Adrian Hills)</author><guid>https://www.adathedev.co.uk/2010/02/sql-server-2008-table-valued-parameters.html</guid><description>The scenario is, you want to create a stored procedure that returns the records relating to a finite set of keys/IDs that you pass in to it. How do you do it? Well you could use dynamic SQL, but for the purpose of this article I&amp;rsquo;m going to ignore that option.
Test scenario -- Create basic customer table CREATE TABLE [dbo].[Customer] ( Id INTEGER IDENTITY(1,1) PRIMARY KEY, Name NVARCHAR(50) NOT NULL ); GO -- Populate Customer table with 100,000 sample records DECLARE @Counter INTEGER SET @Counter = 1 WHILE (@Counter &amp;lt;= 100000) BEGIN INSERT Customer (Name) VALUES (&amp;#39;Test Customer #&amp;#39; + CAST(@Counter AS VARCHAR(10))) SET @Counter = @Counter + 1 END Option 1 - CSV list of keys In SQL Server 2000, you would most likely have ended up passing in a CSV list of keys, splitting that out into a table, and then joining that on to your real data table to match the records to return.</description></item></channel></rss>