Solved

SQL XML Parse

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
T-SQL Stored Procedure - Search multiple tables (Single column) for similar values 7 62
GRANT, REVOKE, DENY 4 37
Sql query to Stored Procedure 6 38
In or Between 2 44
After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

896 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