我在 SQL Server 2005 中有一个视图,其中包含一列 xml 数据。该列来自for xml path()
查询,即
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
我现在想在以 xml 形式返回数据的存储过程中引用此视图,即
create procedure getWebsiteMainCalendarEvents
@startDate datetime,
@endDate datetime
as
select * from vwWebsiteMainCalendar
where startDate between @startDate and @endDate
order by startDate for xml path() element
当我运行该过程时,我希望视图中的场所显示为子节点,但<
被>
编码为 html 实体。有没有办法让程序将 xml 数据视为输出中的 xml 节点?