Comments in XQuery
Applies to: SQL Server
You can add comments to XQuery. The comment strings are added by using the "(:
" and ":)
" delimiters. For example:
declare @x xml
set @x=''
SELECT @x.query('
(: simple query to construct an element :)
<ProductModel ProductModelID="10" />
')
Following is another example in which a query is specified against an Instruction column of the xml type:
SELECT Instructions.query('
(: declare prefix and namespace binding in the prolog. :)
declare namespace AWMI="https://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions";
(: Following expression retrieves the <Location> element children of the <root> element. :)
/AWMI:root/AWMI:Location
') as Result
FROM Production.ProductModel
where ProductModelID=7
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for