Chapter 14. XML and SQL Server: Retrieving Data
The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music.Donald Knuth[1]
[1] Knuth, Donald. The Art of Computer Programming Vol. 1 Fundamental Algorithms. Reading, MA: Addison-Wesley, 1997. Page v.
Thus far, we've used FOR XML AUTO to return SQL Server data in a basic XML format so that we could work with it from a Web browser. Transact-SQL's FOR XML syntax is much richer than this, though. It supports several options that extend its usefulness in numerous ways. In this chapter, we'll discuss a few of these and work through examples that illustrate them.