0
我試圖運行查詢,以便行集將返回元素的內容。下面是我的查詢,以及XML列中的數據示例。在Address列中返回的是全部NULL。但我知道表格中的元素有數據。我究竟做錯了什麼。編寫查詢以從SQL Server XML數據列中提取特定數據
WITH XMLNAMESPACES('http://schemas.xmlsoap.org/soap' AS "soap")
SELECT
Data.value('(/soap:Envelope/soap:Body/Report/Location/Address/node())[1]', 'nvarchar(max)') as Address
FROM Mytable
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<Report>
<Location>
<Address>600 BENNETT ST</Address>
</Location>
</Report>
<soap:Body>
<soap:Envelope>