I’ve the following SELECT Query:
SELECT
'2012' 'period',
Person.Name 'users/person'
FROM Person
FOR XML PATH(''), ROOT ('company')
this gives me the following XML:
<company>
<period>2012</period>
<users>
<person>Dubach</person>
</users>
<period>2012</period>
<users>
<person>Pletscher</person>
</users>
<period>2012</period>
....
I would like to have the “period”-tag just once at the beginning of the result XML. how can I achieve this?
1 Answer