Solved

SQL XML Parse

Posted on 2015-02-05
1
101 Views
Last Modified: 2015-02-08
How to query to get value of xml element when shown as below.
 
I have this in an xml doc . I can query and get any value successfully however  this returns a null every-time, does this require special handling while querying XML.


I have tried OpenXml and node() function everything returns NULL...
doc.col.value('ListPrice[1]', 'float') Price   --RETURNS NULL

 
<ListPrice Type="FLOAT" CurrencyCode="USD">139900.00</ListPrice>

Open in new window

0
Comment
Question by:leadcodev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
Habib Pourfard earned 500 total points
ID: 40592905
it works for me:
DECLARE @XMLData XML = '<ListPrice Type="FLOAT" CurrencyCode="USD">139900.00</ListPrice>'
SELECT @XMLData.value('ListPrice[1]','float')

Open in new window

0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question