I have MyTable
structured as below:
ColumnA | ColumnB
-----------------
ValueA | ValueB
And would like to produce XML like below:
<ValueA>ValueB</ValueA>
This doesn't work but it's the closest I get. I get a syntax error; apparently you can't use a column value in the ROOT
function. Any suggestions are greatly appreciated.
SELECT ColumnB as "data()"
FROM MyTable
FOR XML PATH (''), ROOT(ColumnA)