sql - select element frequency over xml column -


Consider this table structure in SQL Server:

  ID - Unique Identifier Param - Xml   

and rows in the following formats:

    

Expected production (the sum of all events in each element in the table):

  _______________ | Module 1 | 2 | | Module 2 | 1 | | _____________ |   

The number of elements in each line is module 0 ... n I was trying to create a stored procedure that was used by each XML The field returns several rows for the input and then contributes the results to the temporary table from each row, but I did not have luck with finding the right syntax. Does any reference to a relevant resource or show some small snippets how to deal with it? Thanks for any indication provided.

You can also apply some exclamation to capture module names and then assign them a Group BY:

  SELECT ModuleName, COUNT (*) AS from NumOcurrences (SELECT Nodes.node.value ('(ModuleName) [1]', 'varchar (50)' ) As M.P. Nodes ('/ / module') in the form of Module M as Nodes (Node); ModuleName by X Group;   

(Unfortunately, we can not group directly on XML, therefore a derived table is required)



Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -