Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Example: Specifying the CDATA Directive

Example: Specifying the CDATA Directive

If the directive is set to CDATA, the contained data is not 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.

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

This is the result:

<ProductModel ProdModelID="19" Name="Mountain-100">
   <![CDATA[<Summary>This is summary description</Summary>]]>

Community Additions

© 2015 Microsoft