The xmlns attribute in the following code stops me getting the value I need. Works fine with any other attribute but not xmlns. I have no control over the xml I'm given - how can I get the CrpId value?
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