tailieunhanh - Microsoft SQL Server 2005 Developer’s Guide- P27

Microsoft SQL Server 2005 Developer’s Guide- P27:SQL Server 2005 is a feature-rich release that provides a host of new tools and technologies for the database developer. This book is written to help database developers and DBAs become productive immediately with the new features and capabilities found in SQL Server 2005. | Chapter 7 Developing with XML 239 Name Last_Name Brown Last_Name First_Name Kevin First_Name Name Employee Employee Employee_ID 3 Name Last_Name Tamburello Last_Name First_Name Roberto First_Name Name Employee For more information about using the XML Explicit mode see the SQL Server 2005 BOL. Type Mode When XML data types are returned using the FOR XML clause s Type mode they are returned as XML data types. You can see an example of using the FOR XML clause with the XML Type directive here SELECT DocID MyXMLDoc FROM MyXMLDocs WHERE DocID 1 FOR XML AUTO TYPE NOTE ------ This listing uses the example MyXMLDocs table that was created earlier in this chapter. nu query returns the relational DocID column along with the MyXMLDoc XML data type column. It uses the FOR XML AUTO clause to return the results as XML. The TYPE directive specifies that the results will be returned as an XML data type. You can see the results of using the Type directive here MyXMLDocs DocID 1 MyXMLDoc MyXMLDoc xmlns http MyXMLDocSchema DocumentID 1 DocumentID DocumentBody Modified Body DocumentBody MyXMLDoc MyXMLDoc MyXMLDocs 1 row s affected 240 Microsoft SQL Server 2005 Developer s Guide NOTE ------ The preceding listing was reformatted to make it more readable in the published page width. FOR XML Path The new FOR XML PATH mode provides increased power to shape XML results than either the FOR XML AUTO or FOR XML RAW mode but without the complexity of the FOR XML EXCLICIT mode. The new PATH mode allows users to specify the path in the XML tree where an element or attribute can be added. Essentially the new PATH mode is a simpler alternative to the FOR XML EXCPLICIT mode. It can accomplish most of the things the developers need with the use of universal tables and complex unions. However it is more limited than the FOR XML EXPLICIT mode. You can see an example of using the FOR XML PATH mode in the following listing SELECT Top 3 title FirstName LastName from FOR XML PATH This query

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã 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.