我已經在SQL服務器中獲得了一張表,其中XML存儲在一列中。避免在SQL服務器中自動創建XML標籤
CREATE TABLE [dbo].[MyTable](
[MyId] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED,
[MyContent] [xml] NULL
)
列 「爲myContent」 的XML看起來是這樣的:
<Account id="1">
<Name>Bill</Name>
</Account>
現在我想連接的所有列到一個大的XML。 我試圖做到這一點與「爲XML」功能的SQL-服務器:這樣
select
MyContent
from MyTable
for xml path('')
的XML,創建外觀:
<MyContent>
<Account id="1">
<Name>Bill</Name>
</Account>
</MyContent>
<MyContent>
<Account id="2">
<Name>John</Name>
</Account>
</MyContent>
但是,這是我需要的不是什麼,我需要XML沒有創造「爲myContent」的標籤,所以我需要的是這樣的:
<Account id="1">
<Name>Bill</Name>
</Account>
<Account id="2">
<Name>John</Name>
</Account>
有什麼辦法避免標籤創建的列名?
太好了,非常感謝你 – Chris