次のコードの xmlns 属性が原因で、必要な値を取得できません。他の属性では問題なく動作しますが、xmlns では動作しません。与えられた xml を制御できません - どうすれば CrpId 値を取得できますか?
declare @CrpId int, @i int, @xml xml
set @xml =
'<NewProgressReportResult xmlns="http://myDomain.com/crp">
<CrpId>2160</CrpId>
</NewProgressReportResult>'
exec sp_xml_preparedocument @i output, @xml
select
CrpId
from openxml (@i, 'NewProgressReportResult', 2)
with (
CrpId int 'CrpId'
)
exec sp_xml_removedocument @i