| ||
In this chapter you learned that:
The XML data type is a specialized data type, used for storing XML documents within an SQL Server database.
SQL Server XML data methods include query() , value() , exist() , and modify() methods; which are executed directly against XML data types.
The query() method retrieves nodes, including all child elements from an XML data type.
The value() method retrieves a single value from an XML data type.
The exist() method validates the existence of items in an XML data type.
The modify() method allows for changes to XML data.
The FOR XML clause enhances the SQL Server SELECT statement, allowing for queries to convert directly to XML output.
The FOR XML clause can be executed in RAW , AUTO , EXPLICIT , or PATH mode.
The FOR XML RAW mode returns a single XML element for each record returned by a query.
The FOR XML AUTO mode is more sophisticated than RAW mode, returning a single layer of nested elements for each table in a join query.
The FOR XML EXPLICIT mode allows for complete control over how XML is displayed, allowing for return of properly structured XML document hierarchical data.
The FOR XML PATH mode is a more sophisticated and easier-to-use option than the FOR XML EXPLICIT mode.
The OPENXML function can be used to access an XML data type as if it were a set of relational tables.
The OPENROWSET function can be used to bulk-load entire XML documents (stored on disk outside of an SQL Server database), directly into an XML data type inside a table.
XML Schema Definition schemas (XSD schemas) can be used to generically impose schema structure onto an XML data type, using a SQL Server schema collection.
XSD can be used to enforce table structure onto XML documents, and even the relationships between those relational database tables.
| ||