Summary

Anyone reading this book that remembers trying to use XML with SQL Server 2000 should also remember how much of a pain it was to work with (XML, not SQL Server ). There was no XML data type in SQL Server then, but XML was quickly gaining popularity. Anyone remember XHTML?

To the rescue comes SQL Server 2005 with the wonderful XML data type and the ability to work with XML natively. While it wasn't perfect (FOR XML EXPLICIT, ugh) and the performance wasn't great, it was FAR better than what you were working with previously.

Over the years improvements have been made and performance increased to make it a solid way to store and work with XML documents and fragments in SQL Server. However, as mentioned at the beginning of this chapter, very little was added to SQL Server 2012 for the XML data type, but that doesn't mean it isn't valuable.

This chapter covered the XML data type and its associated methods and syntax. You also spent considerable time discussing XQuery and the FLWOR statements used to easily and efficiently query XML as well as the FOR XML clause to format the shape of resulting XML when querying TDS data.

Get Microsoft SQL Server 2012 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.