TAILIEUCHUNG - Hướng dẫn học Microsoft SQL Server 2008 part 50

Các ví dụ trên đây tham gia bàn OrderHeader với bảng OrderXML và tham gia này là từ một cột quan hệ và nút một XML. Một lần nữa, khác tham gia được thiết lập giữa các bảng Tìm và các yếu tố khoản được trả về bởi các nút () phương pháp. Một cách khác để viết các truy vấn này là để nhúng tham gia vận hành như một phần của biểu thức XQuery chính nó. Ví dụ sau đây minh chứng điều này:. | Part III Beyond Relational INNER JOIN Customers c ON INNER JOIN Items i ON @ItemNumber CHAR 4 OrderID Customer Item Quantity Price 1 Jacob Sebastian DELL XPS 1130 Laptop 1 1 Jacob Sebastian XBOX 360 Console 1 2 Jacob Sebastian DELL XPS 1130 Laptop 1 The preceding example joins the OrderHeader table with the OrderXML table and this join is between a relational column and an XML node. Again another join is established between the Items table and the Item elements returned by the nodes method. Another way to write this query is to embed the join operators as part of the XQuery expression itself. The following example demonstrates this SELECT AS Customer AS Item @Quantity INT AS Quantity @Price MONEY AS Price FROM OrderHeader oh INNER JOIN Customers c ON CROSS JOIN OrderXML CROSS JOIN Items i CROSS APPLY Order @OrderID sql column Item @ItemNumber sql column o x OrderID Customer Item Quantity Price 1 Jacob Sebastian DELL XPS 1130 Laptop 1 1 Jacob Sebastian XBOX 360 Console 1 2 Jacob Sebastian DELL XPS 1130 Laptop 1 The capability to join relational tables with XML nodes opens up a wide variety of possibilities to perform join operations between relational and XML data. Using variables and filters in XQuery expressions SQL Server allows only string literals as XQuery expressions. The following is illegal in SQL Server 2008 DECLARE @node VARCHAR 100 SELECT @node Order Item 452 Manipulating XML Data 18 SELECT columns here FROM OrderXML CROSS APPLY @node o x Although you might want to use such an expression it won t work I see this in XML forums all the time. Don t make the same mistake. There are two common scenarios in which one might need to use variables in XQuery expressions To apply filters on the value of elements or attributes

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.