Solved

SQL XML Parse

Posted on 2015-02-05
1
94 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
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now