sql server - How to extract an element from an XML file? -


i have following simple xml fragment shown below. t-sql if wanted extract 'entityfriendlyname' attribute?

<simplerulevalue xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema">     <entityid>0</entityid>     <entityfriendlyname>aline</entityfriendlyname> </simplerulevalue> 

it this:

select cast(x.somexml xml).value('(simplerulevalue/entityfriendlyname)[1]','nvarchar(1000)') entityfriendlyname xmlsource x 

edit: a little more information.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -