O'Reilly logo

XML and JSON Recipes for SQL Server: A Problem-Solution Approach by Alex Grinberg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

©  Alex Grinberg 2018
Alex GrinbergXML and JSON Recipes for SQL Serverhttps://doi.org/10.1007/978-1-4842-3117-3_2

2. Building XML

Alex Grinberg
(1)
Richboro, Pennsylvania, USA
 
XML is represented in SQL Server using a complex data type that has special syntax and well-defined format. It can be used when we need to construct XML-formatted output or shred existing XML into relational format. In this chapter I will provide recipes for building XML from a result set based on one or more tables, and for formatting and presenting the result as XML output.
Introduced in SQL Server 2000, the FOR XML clause has evolved dramatically to become a comprehensive solution for building XML output. FOR XML has to be the last clause in a SELECT statement and has to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required