More on the nodes() method
Posted by decipherinfosys on October 13, 2008
We have written before about using the nodes() method in order to de-construct XML as relational data. Yesterday, while working at a client issue we got a XML file which had a combination of attribute and element centric XML in it. There are many ways to de-construct such a file – we, once again, used the nodes() method to break it up.
You can access the code here. If you see the code, we started from the deepest end and worked our way upwards. In addition, we used the cross apply in order to get the data for the node which did not have the node that we had used for the deepest level. There are a couple of other ways also to do this and we will post the different permutations in an upcoming whitepaper on XML usage in SQL Server 2005 and 2008.