TAILIEUCHUNG - Using the SQL Server FOR XML Clause

Sử dụng SQL Server FOR XML khoản Với một tuyên bố tiêu chuẩn SELECT SQL, bạn gửi câu lệnh SELECT của bạn vào cơ sở dữ liệu để thực hiện và nhận được kết quả trở lại dưới hình thức hàng. SQL Server mở rộng các câu lệnh SELECT để cho phép bạn truy vấn cơ sở dữ liệu và nhận được kết quả lại như XML. Để làm điều này, bạn thêm một FOR XML khoản vào cuối câu lệnh SELECT của bạn. . | Using the SQL Server FOR XML Clause With a standard SQL SELECT statement you submit your SELECT statement to the database for execution and get results back in the form of rows. SQL Server extends the SELECT statement to allow you to query the database and get results back as XML. To do this you add a FOR XML clause to the end of your SELECT statement. The FOR XML clause specifies that SQL Server is to return results as XML. The FOR XML clause has the following syntax FOR XML RAW AUTO EXPLICIT XMLDATA ELEMENTS BINARY BASE64 The RAW AUTO and EXPLICIT keywords indicate the XML mode. Table shows a description of the keywords used in the FOR XML clause. In the next sections you ll examine some examples of the use of the FOR XML clause. Table FOR XML KEYWORDS KEYWORD DESCRIPTION RAW Specifies that each row in your result set is returned as an XML row element. The column values for each row in the result set become attributes of the row element. AUTO Specifies that each row in the result set is returned as an XML element The name of the table is used as the name of the tag in the row elements. EXPLICIT Indicates your SELECT statement specifies a parent-child relationship. This relationship is then used by SQL Server to generate XML with the appropriate nested hierarchy. XMLDATA Specifies that the XML schema is to be included in the returned XML. ELEMENTS Specifies that the column values are returned as subelements of the row otherwise the columns are returned as attributes of the row. You can use this option only with the AUTO mode. BINARY BASE64 Specifies that any binary data returned by your SELECT statement is encoded in base 64. If you want to retrieve binary data using either the RAW or EXPLICIT mode then you must use the BINARY BASE64 option. Using the RAW Mode You use the RAW mode to specify that each row in the result set returned by your SELECT statement is returned as an XML row element. The column values for each row in the result set become .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.