Re: how to export view to display - xml with specific xsd?
- From: "Marc Gravell" <marc.gravell@xxxxxxxxx>
- Date: Tue, 18 Dec 2007 07:54:14 -0000
xsd is more for input validation and query optimisation than output
format.
In SQL-Server 2005, the easiest approach is FOR XML PATH
As an example (using some random layout):
SELECT so.id AS '@id',
so.name AS 'name',
so.userstat AS 'stat/@user',
so.sysstat AS 'stat/@sys',
( SELECT sc.name AS '@name'
FROM syscolumns sc
WHERE sc.id = so.id
FOR XML PATH('col'), TYPE) AS 'cols'
FROM sysobjects so
FOR XML PATH('table'), ROOT('tables')
Marc
.
- Prev by Date: Re: Not bad, but how could we make it dynamic?
- Next by Date: Re: Question about schema collection
- Previous by thread: Cross Joining two XML columns, or two (or more) XML variables
- Next by thread: Re: how to export view to display - xml with specific xsd?
- Index(es):
Loading