sql server xquery count child nodes

Solutions on MaxInterview for sql server xquery count child nodes by the best coders in the world

showing results for - "sql server xquery count child nodes"
Melina
03 Sep 2018
1This will count the number of Colors nodes which is 1.
2
3select @MyXML.value('count(/SampleXML/Colors)', 'int')
4
5This will count the number of rows in Colors which is 5.
6
7select @MyXML.value('count(/SampleXML/Colors/*)', 'int')