私は次のxmlドキュメントを持っています
<Root>
<Translation>
<Entry language ="ES" text = "Alsace"/>
<Entry language ="DE" text = "Elsass"/>
<Entry language ="EN" text = "Alsace"/>
</Translation>
<Translation>
<Entry language ="ES" text = "Brittany"/>
<Entry language ="DE" text = "Bretagne"/>
<Entry language ="EN" text = "Brittany"/>
</Translation>
</Root>
グループを保存しながら、テーブルに細かく刻む必要があります。したがって、translation要素にはid属性がないため、グループ化は構造内で暗黙的に行われます。
テーブルの結果は次のようになります。
translation_id, lanuage, text
---------------------------------
1,ES, Alsace
1,DE, Elsass
1,EN, Alsace
2,ES , Brittany
2,DE, Bretagne
2,EN Brittany
いろいろ試してみました
select newid(),
( select rows.n.value('(@language)[1]', 'nvarchar(max)')
from @p.nodes('/Translation/Entry') rows(n)
)
from @p.nodes('/Translation') rows(n)
しかし、ある種のループを使用せずにグループ化IDを取得することはできないようです。
ありがとう