我有一个 xml 文件,它作为 SQL Server 中存储过程的输入。我有一个表,其中包含列element name
和parent id
. 根元素父 id 为 0,第一个元素父 id 为 1,依此类推。我如何实现这一目标?
我的 xml 中有几种复杂类型
<VoyageOrderMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="voyage.xsd">
<MessageHeader>
<MessageId>ID</MessageId>
<MessageDate>2009-11-01T11:42:07.414+03:00</MessageDate>
<MessageTypeVersion>Version</MessageTypeVersion>
<SenderId>SI</SenderId>
<ReceiverDetails>
<ReceiverMethod />
<ReceiverFormat />
<ReceiverAddress></ReceiverAddress>
</ReceiverDetails>
</MessageHeader>
<VoyageOrder>
<VoyageID>RG-FUW-001</VoyageID>
<Amendment>4</Amendment>
<IMO>9256200</IMO>
<VesselName>Fuwairit</VesselName>
<ShipMasterName />
<OrderDate>2009-11-01T11:41:59.149+03:00</OrderDate>
<Passage>
<PassageNumber>1</PassageNumber>
<PassageType>Laden</PassageType>
<DeparturePortName>Ras Laffan</DeparturePortName>
<DeparturePortCode>RLF</DeparturePortCode>
<DepartureTime>2009-10-06T19:06:00.000+03:00</DepartureTime>
<ArrivalPortName>Suez</ArrivalPortName>
<ArrivalPortCode>SUZ</ArrivalPortCode>
<ArrivalTime>2009-10-13T03:00:00.000+02:00</ArrivalTime>
</Passage>
示例输出
elementname parent id column
------------------------------
voyageorder 0 1
messageheader 1 2
messageid 2 3
etc
任何帮助表示赞赏