Tài liệu Module 3: Validating pdf

30 517 0
Tài liệu Module 3: Validating pdf

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Appendix C: Appendix to Chapter 9: SQL XML You can use this appendix to extend your knowledge of Microsoft® SQL Server™ 2000 support for Extensible Markup Language (XML) This continues where Module 9, “SQL XML,” leaves off In addition, there are two lab exercises at the end of this appendix To begin them, you must first complete the first two exercises in Lab Lesson: FOR XML and OpenXML In this lesson, you will learn about the FOR XML and OpenXML query types FOR XML Introduction To query a SQL Server database, the XML query must specify the type of output required This is indicated by the mode in the FOR XML clause There are three modes to choose from: RAW, AUTO, and EXPLICIT You can specify three additional parameters to return particular XML output You determine the form of the output by using these various modes and parameters The form of the output depends on your application requirements and what other uses you plan to put the data to Appendix C: Appendix to Chapter 9: SQL XML Syntax The syntax of the FOR XML clause is: FOR XML mode [, XMLDATA] [, ELEMENTS][, BINARY BASE64] The arguments that you can use in the FOR XML clause are listed in the following table Argument mode The XML mode determines the shape of the resulting XML It can be RAW, AUTO, or EXPLICIT You must specify one mode XMLDATA If the XMLDATA option is specified, a schema should be returned The schema is prepended to the document as an inline schema ELEMENTS If the ELEMENTS option is specified, the columns are returned as subelements Otherwise, they are mapped to XML attributes This option is supported in AUTO mode only BINARY BASE64 FOR XML RAW Purpose When the BINARY BASE64 option is specified, any binary data returned by the query is represented in base64-encoded format To retrieve binary data in RAW and EXPLICIT mode, this option must be specified In AUTO mode, binary data is returned as a reference by default The use of the RAW mode means that the results of the query are represented by a row element with attributes mapped to the column names for values that are not NULL Consider the following query: SELECT EmployeeID, LastName, FirstName FROM Employees ORDER BY LastName, FirstName FOR XML RAW This produces the following output:

Ngày đăng: 24/01/2014, 10:20

Tài liệu cùng người dùng

Tài liệu liên quan