How do I wrap OldValue in a CDATA?
SELECT
1 AS Tag,
0 AS Parent,
(
SELECT PositionDescription AS 'data()'
FROM dbo.Project where ID = 32
FOR XML PATH('')
) AS 'PositionDescription!1!OldValue!CDATA'
FOR XML EXPLICIT, TYPE
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just drop the TYPE keyword. And use the raw string rather than XML in the subquery
Sample & Output