Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 return non-escaped xml

Author  Topic 

chedderslam
Posting Yak Master

223 Posts

Posted - 2009-11-10 : 13:05:43
I am currently returning several xml documents in a result set and converting the output to xml. Because of the xml in xml, it is escaping the < and >. I am having to run a replace function on the returned data and it is taking way too long for more than a couple of rows. Is it possible to have the nested xml not escaped?

Here is the query:
select 1 as tag,
null as parent,
null as [root!1],
null as [entry_data!2]
union all

select 2 as tag,
1 as parent,
null,
l.entry_data
from my_log l
inner join @rating_ids r
on l.pos_id = r.rating_id
where l.entry_type = 0
for xml explicit

Here is an example of what the returned data looks like:
<root>
<entry_data><?xml version="1.0"?><my_data/></entry_data>
</root>
   

- Advertisement -