I am trying to parse a snippet of xml using the following tsql. It is working without errors but I am getting null data rather than the values in double quotes:
DECLARE @x XML;SET @x = '<logger><TH date="20150730133052" id="th0" temp="21.9" hum="61" dew="14.0"/><WIND date="20150730133114" id="wind0" dir="0" gust="0.0" wind="0.0" chill="21.9"/><RAIN date="20150730133016" id="rain0" rate="0.0" total="0.0" delta="0.0"/><THB date="20150730133040" id="thb0" temp="24.0" hum="53" dew="13.8" press="1021.7" seapress="1022.0" fc="2"/></logger>';SELECT tbl.TH.value('date[1]', 'varchar(100)') AS [date] ,tbl.TH.value('id[1]', 'varchar(100)') AS id ,tbl.TH.value('temp[1]', 'varchar(100)') AS temp ,tbl.TH.value('hum[1]', 'varchar(100)') AS hum ,tbl.TH.value('dew[1]', 'varchar(100)') AS dewFROM @x.nodes('/logger/TH') AS tbl(TH);
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.