Ghi
Quyền truy cập vào trang này yêu cầu sự cho phép. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Quyền truy cập vào trang này yêu cầu sự cho phép. Bạn có thể thử thay đổi thư mục.
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
SQL database in Microsoft Fabric
For each row in the result set, the RAW mode generates an element <row>. You can optionally specify another name for this element by specifying an optional argument to the RAW mode, as shown in this query. The query returns a <ProductModel> element for each row in the rowset.
Example
SELECT ProductModelID, Name
FROM Production.ProductModel
WHERE ProductModelID = 122
FOR XML RAW ('ProductModel'), ELEMENTS;
GO
This is the result. Because the ELEMENTS directive is added in the query, the result is element-centric.
<ProductModel>
<ProductModelID>122</ProductModelID>
<Name>All-Purpose Bike Stand</Name>
</ProductModel>