我有一点问题,我从互联网上获得了这段代码,我修改它以供我自己使用。我运行示例,它工作正常,没问题。在我为我的程序更改它之后,它没有显示任何错误,只有0 行受到影响。结果,xml 列什么也没返回。我希望得到一些提示。
declare @input XML
set @input = '<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<CurrencyTransact>
<BCurrencyCode>USD</BCurrencyCode>
<StockBalance>18000.00</StockBalance>
</CurrencyTransact>
<CurrencyTransact>
<BCurrencyCode>MYR</BCurrencyCode>
<StockBalance>30000.00</StockBalance>
</CurrencyTransact>
'
;with GrabXML AS
(
select
CurrencyBal.value('@BCurrencyCode', 'varchar(10)') as 'BCurrencyCode',
CurrencyBal.value('@StockBalance', 'decimal(18,2)') as 'StockBalance'
from
@input.nodes('/NewDataSet/CurrencyTransact') as n(CurrencyBal)
)
update dbo.Currency
set StockBalance = g.StockBalance
from GrabXML g
where dbo.Currency.CurrencyCode = g.BCurrencyCode