Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

what is this meaning of this xquery? Expand / Collapse
Author
Message
Posted Wednesday, November 6, 2013 7:32 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, March 12, 2014 6:50 PM
Points: 39, Visits: 141
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::PD:ProductDescription/child::PD:Features/parent::PD:ProductDescription/child::PD:Summary
')
FROM Production.ProductModel
WHERE ProductModelID=19


and it was suggested to change the above xquery to


/child::PD:ProductDescription[child::PD:Features]/child::PD:Summary


both query returns

<PD:Summary xmlns:PD="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::PD:ProductDescription[child::PD:Features]/child::PD: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

Post #1511881
Posted Wednesday, November 6, 2013 11:11 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 3:57 PM
Points: 7,064, Visits: 15,270
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?
Post #1511963
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse