Please consider this simple example. I can't get the text of the state element 'red' or 'blue' Please help!!!!! this is driving me batty
DECLARE @xml XML;
SET @xml = '<capitals>
<state name="Alabama"
abbreviation="AL"
capital="Montgomery" >red</state>
<state name="Alaska"
abbreviation="AK"
capital="Juneau" >blue</state>
<state name="Arizona"
abbreviation="AZ"
capital="Phoenix" >green</state>
</capitals>';
SELECT Node.value('@name', 'varchar(100)') AS Name,
Node.value('@abbreviation', 'varchar(2)') AS Abbreviation,
Node.value('@capital', 'varchar(100)') AS Capital
FROM @xml.nodes('/capitals/state') TempXML (Node);