I have got an table in SQL-Server, where I have XML stored in one column.
CREATE TABLE [dbo].[MyTable](
[MyId] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED,
[MyContent] [xml] NULL
)
The xml in the column "MyContent" looks like this:
<Account id="1">
<Name>Bill</Name>
</Account>
Now I want to concatenate all columns to one big xml. I tried to do that with "for xml" function in SQL-Server:
select
MyContent
from MyTable
for xml path('')
The XML, that is created looks like this:
<MyContent>
<Account id="1">
<Name>Bill</Name>
</Account>
</MyContent>
<MyContent>
<Account id="2">
<Name>John</Name>
</Account>
</MyContent>
But that is not what I needed, I need the XML without the created "MyContent" Tags, so what I need is this:
<Account id="1">
<Name>Bill</Name>
</Account>
<Account id="2">
<Name>John</Name>
</Account>
Is there any way to avoid the Tag creation for the column name?