If i wanted to add an attribute to the root element record, can i do this from the sql side?
SELECT top 1 \'text\' as nodeA
from test as z
FO
Use the new FOR XML PATH syntax:
SELECT TOP 1
'someValue' AS '@Attribute',
'text' as 'z/NodeA'
FROM dbo.Test
WHERE....
FOR XML PATH('YourElement'), ROOT('Root')
This would give something like
text
Read more about it here: