T-Sql returning XML column data as a node in a FOR XML query

ngkynam

New Member
I have a view in SQL Server 2005 that contains a column of xml data. The column comes from a \[code\]for xml path()\[/code\] query, ie\[code\]SELECT e.id, eventTypeCode, e.startDate, e.endDate,(select v.name from venue v inner join eventVenue ev on ev.venueCode=v.code where ev.eventId=e.id for xml path('venue')) as venues FROM dbo.event e inner join eventType t on e.eventTypeCode=t.code \[/code\]I now want to refer to this view in a stored procedure that returns data as xml, ie\[code\]create procedure getWebsiteMainCalendarEvents@startDate datetime,@endDate datetimeasselect * from vwWebsiteMainCalendar where startDate between @startDate and @endDate order by startDate for xml path() element\[/code\]I'd like the venues from the view to appear as subnodes when I run the procedure, but \[code\]<\[/code\] and \[code\]>\[/code\] are encoded as html entities. Is there a way to get the procedure to treat xml data as an xml node in the output?
 
Back
Top