TAILIEUCHUNG - Beginning C# 2008 Databases From Novice to Professional phần 4

Các cơ sở dữ liệu tempdb giữ bảng tạm thời và các đối tượng cơ sở dữ liệu tạm thời khác, hoặc tạo ra tự động bởi SQL Server hoặc tạo ra một cách rõ ràng của bạn. Cơ sở dữ liệu tạm thời được tái tạo mỗi lần dụ SQL Server là bắt đầu, vì vậy các đối tượng trong nó không tồn tại sau khi SQL Server là đóng cửa. | CHAPTER 7 USING XML 127 the FOR XML RAW mode as shown in the following example. To achieve this you need to add an alias after the FOR XML RAW clause which you ll do now. 1. Replace the existing query in the query window with the following query and click Execute. SELECT ProductModelID Name FROM WHERE ProductModelID between 98 and 101 FOR XML RAW ProductModelDetail ELEMENTS 2. You will see a link in the results pane of the query window. Click the link and you should see the results shown in Figure 7-3. Figure 7-3. Renaming the row element How It Works FOR XML RAW alias mode produces output where the row element is renamed to the alias specified in the query. Because the ELEMENTS directive is added in the query the result is element centric and this is why the row element is renamed with the alias specified. If you don t add the ELEMENTS keyword in the query the output will be attribute centric and the row element will be renamed to the alias specified in the query. 128 CHAPTER 7 USING XML Observations About FOR XML RAW Formatting FOR XML RAW does not provide a root node and this is why the XML structure is not a well-formed XML document. FOR XML RAW supports attribute- and element-centric formatting which means that all the columns must be formatted in the same way. Hence it is not possible to have the XML structure returned with both the XML attributes and XML elements. FOR XML RAW generates a hierarchy in which all the elements in the XML structure are at the same level. Using FOR XML AUTO FOR XML AUTO mode returns query results as nested XML elements. This does not provide much control over the shape of the XML generated from a query result. FOR XML AUTO mode queries are useful if you want to generate simple hierarchies. Each table in the FROM clause from which at least one column is listed in the SELECT clause is represented as an XML element. The columns listed in the SELECT clause are mapped to attributes or subelements. Try It Out .

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.