I have this query here:
SELECT [Job_No] as '@Key',
(
)
FOR XML PATH('Job_No'), ROOT('Root')
and it returns like so:
<Root>
<Job_No Key="ORC0023">
</Job_No>
</Root>
How do I get it like so:
<Root>
<Key>ORC0023</Key>
</Root>
I have this query here:
SELECT [Job_No] as '@Key',
(
)
FOR XML PATH('Job_No'), ROOT('Root')
and it returns like so:
<Root>
<Job_No Key="ORC0023">
</Job_No>
</Root>
How do I get it like so:
<Root>
<Key>ORC0023</Key>
</Root>
try this:
SELECT [Job_No] as 'Key' FROM Jobs
FOR XML PATH(''), root ('Root');
working fiddle