The Gurus Guide to SQL Server Stored Procedures, XML, and HTML [Electronic resources]

Ken Henderson

نسخه متنی -صفحه : 223/ 115
نمايش فراداده

Chapter 13. XML and SQL Server: HTTP Queries

Generally, he who occupies the field of battle first and waits his enemy is at ease; he who comes later to the scene and rushes into the fight is weary.

Sun Tzu[1]

[1] Tzu, Sun. The Art of War. Cambridge, England: Oxford University Press, 1963. Page 96.

As I mentioned in the previous chapter, XML is taking over the world. Someday it will probably even supplant HTML as the most widely used markup language on the Internet. So it's no surprise that SQL Server has built-in support for working with XML. Like most modern DBMSs, SQL Server regularly needs to work with and store data that may have originated in an XML document. Without this built-in support, getting XML to and from SQL Server would require the application developer to translate XML data before sending it to SQL Server and again after receiving it back. Obviously, this could quickly become very tedious, given the ubiquity and growing popularity of the language.

SQL Server is an XML-enabled database. This means that it can read and write XML data. It can return data from databases in XML format, and it can read and update data stored in XML documents. As Web Release 1" at the end of Chapter 15 for more information.)

Table 13-1. SQL Server's XML Features

Feature Purpose
FOR XML An extension to the SELECT command that allows result sets to be returned as XML
OPENXML() Allows reading and writing of data in XML documents
XPath queries Allows SQL Server databases to be queried using XPath syntax
XDR schemas Supports XDR schemas and XPath queries against them