How to create XML in below format from SQL Query in SQL Server?
<ROOT><ELEMENT>VALUE1</ELEMENT></ROOT>
<ROOT><ELEMENT>VALUE2</ELEMENT></ROOT>
<ROOT><ELEMENT>VALUE3</ELEMENT></ROOT>
You can do it something like:
select T.Element as 'Element'
from
(
select 'VALUE1' as Element
union all
select 'VALUE2'
union all
select 'VALUE3'
) as T
for xml path('ROOT')
See MSDN for more information.
<root>, nor is there a rule, that nodes within the XML should not be named as such. But it is - at least - very unusual... The multiple<ROOT>nodes could mean, that you need several independant XMLs... If the existing answers do not solve your issue, please poste some sample data and the expected output, together with some details about your goal. And - last but not least - show what you've tried already...