sql server - Need help on a T-SQL XPath query -


i'm hoping can me solve syntax problem tsql xpath query.

given following xml:

<emails>     <email></email>     <email></email> </emails> 

i'm trying execute following query:

select * messages sendto.value('(/emails/email)[1]', 'nvarchar(max)') '%[email value]%' 

my query looks in first email element , needs in email elements.

thanks, chris

try :-

select * messages cross apply sendto.nodes('/emails/email') artists(a) a.value('(text())[1]', 'nvarchar(max)') '%[email value]%' 

demo in sql fiddle


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -