SQL Server FOR XML

Source: Internet
Author: User
Tags custom name

The FOR XML clause has four of the most basic patterns
1. Auto mode: Returns the data table as the element of the table name, the value of each column is returned as a property;
2. Raw mode: Returns the data behavior element, the value of each column as the attribute of the element;
3. Path mode: Allows users to customize nested XML structures, elements, attribute values through simple XPath syntax
4. Explicit mode: Defines the structure of the output XML through the SELECT syntax

The query result set is presented in XML, simplifying query statements to implement some of the work that might have previously been done with the help of a function stored procedure

Select *  fromBasetype_bty forXML AutoSelect *  fromBasetype_bty forXmlRawSelect *  fromBasetype_bty forXmlRaw, ElementsSelect *  fromBasetype_bty forXmlRaw, Elements XsinilSELECT *  fromBasetype_bty forXML PATH--the custom name is <myhobby>SELECT *  fromBasetype_bty forXML PATH ('Myhobby')

SQL Server FOR XML

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.