这是我的代码......
DECLARE @XML AS XML;
SET @XML = CAST('<Session id="ID969138672" realTimeID="4300815712">
<VarValues>
<varValue id="ID123" source="Internal" name="DisconnectedBy">VisitorClosedWindow</varValue>
<varValue id="ID1234" source="PreChat" name="email">1234@mail.ru</varValue>
</VarValues>
</Session>
' AS XML)
SELECT
xmlData.Col.value('@id','varchar(max)')
,xmlData.Col.value('@source','varchar(max)')
,xmlData.Col.value('@name','varchar(max)')
FROM @XML.nodes('//Session/VarValues/varValue') xmlData(Col);
这是输出......
如何包含 varValue 的实际值?
我还需要读取值VisistorClosedWindow和1234@mail.ru值