I’d like to know if it is possible to add TAG PREFIX before every ELEMENT TAG
in the result of FOR XML AUTO mode.
I know it’s possible with RAW mode but I need to make its as hierarchy as possible xml result
Something like this:
<prefix:attName>
<prefix:ID>value</prefix:ID>
<prefix:name>value</prefix:name>
</prefix:attName>
and the query in the RAW mode will be like this:
SELECT ID,
Name,
FROM TableName
FOR XML RAW ('prefix'), ROOT('prefix:attName'), ELEMENTS
You can achieve this using Aliases: