SQL Server for xml path add attributes and values



hi i want to create an xml node that contains attributes as well as values.


Example:



<mynode attr1="hello">world</mynode>


I understand that



SELECT 'hello' as '@attr1'


creates at least mynode, but how to attach "world" then?


I tried



SELECT 'world' as 'mynode/[@attr1=hello]'


but didnt work


No comments:

Post a Comment