次の XML があります。
<root>
<fields>
<field>Some Name</field>
<field>Another Name</field>
</fields>
</root>
結果として、私は次のことを望んでいます:
Some Name
Another Name
それを達成するために、次のクエリを実行しようとしています:
DECLARE @XML XML = N'
<root>
<fields>
<field>Some Name</field>
<field>Another Name</field>
</fields>
</root>';
DECLARE @idoc INT;
EXEC sys.sp_xml_preparedocument @idoc OUTPUT, @XML;
SELECT *
FROM OPENXML(@idoc, '/root/fields',2)
WITH (Name VARCHAR(300) './field');
EXEC sys.sp_xml_removedocument @idoc;
しかし、私は最初のレコードしか取得していません...