If you are querying the XML datatype you can query nodes using the sql below:


select 

cast(DOC as xml).query('//trade_id/text()') as trade_id, 
cast(DOC as xml).query('//cdr/text()') as cdr, 
cast(DOC as xml).query('//type_instrument/text()') as 'type_instrument', 
cast(DOC as xml).query('(//product/@type)[0]') as '@type'


from Deals

You may receive this error if you try to query an attribute.
Attribute may not appear outside of an element

Use the data() function to query attributes and resolve this problem

cast(DOC as xml).query('data(//product/@type)') as '@type'

Back to SQL Server

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-1) was last changed on 24-May-2017 15:30 by Hyve Support
G’day (anonymous guest) My Prefs
  • View Page Source
  • This clear IPSec security association,
    clear ipsec sa peer X.X.X.X
    

All Pages

Page views: 1892

Private Tomcat

Linux

MySQL

Email

SQL Server

ASP

JSP

C#

Web Mail

Windows Plesk

Linux Plesk

PHP

Gaming

ASP.NET

Persits ASPUpload

Wiki Help

Referring Pages:
...nobody

JSPWiki v2.8.1