SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


what is this meaning of this xquery?


what is this meaning of this xquery?

Author
Message
mssqlnoob
mssqlnoob
SSC-Enthusiastic
SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)

Group: General Forum Members
Points: 111 Visits: 144
Hi,

with reference to http://technet.microsoft.com/en-us/library/ms190687.aspx

originally the query is


SELECT CatalogDescription.query('
declare namespace PD="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";

/child:TongueDTongueroductDescription/child:TongueD:Features/parent:TongueDTongueroductDescription/child:TongueD:Summary
')
FROM Production.ProductModel
WHERE ProductModelID=19


and it was suggested to change the above xquery to


/child:TongueDTongueroductDescription[child:TongueD:Features]/child:TongueD:Summary


both query returns


<PD:Summary xmlnsTongueD="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription">
<p1:p xmlns:p1="http://www.w3.org/1999/xhtml">Our top-of-the-line competition mountain bike.
Performance-enhancing options include the innovative HL Frame,
super-smooth front suspension, and traction for all terrain.
</p1:p>
</PD:Summary>




what does /child:TongueDTongueroductDescription[child:TongueD:Features]/child:TongueD:Summary means.

even after studying http://technet.microsoft.com/en-us/library/ms177470.aspx, I still could not figure out what the above query is trying to achieve?

thanks
Matt Miller (4)
Matt Miller (4)
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12551 Visits: 18584
It's looking for ProductDescription nodes that have one or more features nodes as children. For those ProductDescription nodes it returns the content of the Summary element.

----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search