コマンドを使用して XML ファイルを動的に作成したいと考えていますxml.modify
。タイプの列を持つテーブルがあり、xml
そのテーブルをカーソルで読み取り、XML ファイルを作成します。
いくつかのテストを行うためだけにこのコードを試していますが、機能しません。
declare @root xml
declare @x xml
set @root = '<Shipment></Shipment>'
set @x = '<ShipmentHeader><ShipID>0001</ShipID></ShipmentHeader>'
select @x
set @root.modify('insert {sql:variable("@x")} into (/Shipment)')
select @root
してただろう
<Shipment>
<ShipmentHeader>
<ShipID>0001</ShipID>
</ShipmentHeader>
</Shipment>