当节点名称相同时,如何从XML查询信息? 在下面的示例中,我尝试提取“ terminatedAccounts”变量,但得到的结果只是第一次出现在同一个名称上(结果为2)。在XML中,它发生了3次,我不知道如何获得此结果。我的代码如下,请添加其余部分。 XML列在代码下方。
SELECT *
FROM
OPENXML(@Handle,'/*[local-name()="SiBikNet"]', 2)
WITH (
terminatedAccounts_pastDueBelow30Days NVARCHAR(10) '*[local-name()="siBikNetResponse"]/creditInquiryResponse/creditReport/bankData/creditSummary/terminatedAccountsNumberWithPaymentStatus/accountsNumber'
);
XML部分:
<terminatedAccountsNumberWithPaymentStatus>
<paymentStatus>pastDueBelow30Days</paymentStatus>
<accountsNumber>2</accountsNumber
</terminatedAccountsNumberWithPaymentStatus>
<terminatedAccountsNumberWithPaymentStatus>
<paymentStatus>writtenOff</paymentStatus>
<accountsNumber>0</accountsNumber>
</terminatedAccountsNumberWithPaymentStatus>
<terminatedAccountsNumberWithPaymentStatus>
<paymentStatus>recovered</paymentStatus>
<accountsNumber>0</accountsNumber>
</terminatedAccountsNumberWithPaymentStatus>