declare @xml xml = '<row id="1" />' --此类型的XML需要在ID前加@,表示属性
SELECT Tbl.Col.value('@id[1]','int') as id FROM @xml.nodes('/row') Tbl(Col)
set @xml = '<row><id>1</id></row>'
SELECT Tbl.Col.value('id[1]','int') as id FROM @xml.nodes('/row') Tbl(Col)
declare @xml xml = '<row id="1" />' --此类型的XML需要在ID前加@,表示属性
SELECT Tbl.Col.value('@id[1]','int') as id FROM @xml.nodes('/row') Tbl(Col)
set @xml = '<row><id>1</id></row>'
SELECT Tbl.Col.value('id[1]','int') as id FROM @xml.nodes('/row') Tbl(Col)