Posts
49
Comments
50
Trackbacks
26
XML
CTE and Hierarchical XML Result

Finally i've managed to have a hierarchical xml result from a CTE Query. I've discovered that SQL Server 2005 cannot do this natively, so at the end i've create a .NET Stored Procedure that takes the XML as it cames out from the CTE and produces a hierarchical one. This is the code so that you can test yourself: Create a sample table with sample values: create table PartsTree (id int, parent int)go insert into PartsTree values (1, null)insert into PartsTree values (2, null)insert into PartsTree values (3, 2)insert into PartsTree values (4, 2)insert into PartsTree values (5, 3)go Create the CTE and make a view...

posted @ Sunday, February 06, 2005 2:50 PM | Feedback (4)
News