Sunday, March 25, 2012

count function

hi

I have a question related to XQUERY in SQL Server . is SQL Server 2005 supports Count function.

i want to make a query in which i want to search for some keyword in all the nodes. If there is some match then count the number of times that word appeared in XML.

Can anybody give me some clue about how to make this query .

thanks in advance

Regards

Ambi

XQuery includes the count() function to count sets of nodes. Here is the documentation on this function containing an example:

http://msdn2.microsoft.com/en-us/library/ms189963.aspx

If you want to query over all the nodes in the query, then the "//" ("descendents") operator will allow you to apply a filter to each node, then you can pass that nodeset to the count() function. Here is the documentation on all the path steps including //

http://msdn2.microsoft.com/en-us/library/ms190451.aspx

No comments:

Post a Comment