Example: Specify the CDATA directive
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
If the directive is set to CDATA, the contained data isn't entity encoded, but is put in the CDATA section. The CDATA attributes must be nameless.
The following query wraps the product model summary description in a CDATA section.
USE AdventureWorks2022;
GO
SELECT 1 as Tag,
0 as Parent,
ProductModelID as [ProductModel!1!ProdModelID],
Name as [ProductModel!1!Name],
'<Summary>This is summary description</Summary>'
as [ProductModel!1!!CDATA] -- no attribute name so ELEMENT assumed
FROM Production.ProductModel
WHERE ProductModelID = 19
FOR XML EXPLICIT;
This is the result:
<ProductModel ProdModelID="19" Name="Mountain-100">
<![CDATA[<Summary>This is summary description</Summary>]]>
</ProductModel>
See also
Зворотний зв’язок
https://aka.ms/ContentUserFeedback.
Очікується незабаром: протягом 2024 року ми будемо припиняти використання механізму реєстрації проблем у GitHub для зворотного зв’язку щодо вмісту й замінювати його новою системою зворотного зв’язку. Докладніше:Надіслати й переглянути відгук про