Retreive Symbols in CDATA section TSQL

  • I have a comment section in my application. I pass xml doc to my procedure.

    I would like to store the CDATA section of my xml doc in a column without any conversion.

    declare @xml xml

    set @xml=

    '<response>

    <test>

    <![CDATA[<greeting>Hello, world!</greeting>]]>

    </test>

    </response>'

    select @xml.query('data(/response/test)')

    Select @xml

    select cast(@xml.query('data(/response/test)') as varchar(124))

    above query will give

    <greeting>Hello, world!</greeting>

    is there way to preserve the special characters in xquery result..

    something like..

    <greeting>Hello, world!</greeting>

    Thanks.

  • Please ignore message. I found the solution.

  • what was it? i got the same problem, thanks.

    www.sql-library.com[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply