Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Retreive Symbols in CDATA section TSQL Expand / Collapse
Author
Message
Posted Monday, November 23, 2009 8:27 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, April 9, 2012 12:26 PM
Points: 2, Visits: 49
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.
Post #823600
Posted Monday, November 23, 2009 9:06 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, April 9, 2012 12:26 PM
Points: 2, Visits: 49
Please ignore message. I found the solution.
Post #823609
Posted Tuesday, July 27, 2010 10:24 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, September 26, 2014 11:40 AM
Points: 374, Visits: 409
what was it? i got the same problem, thanks.

www.sql-library.com
Post #959538
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse