TheServerSide.NET - Heirarchical Queries in SQL Server 2005

8 January, 2005 (16:49) | SQL Server

Hmmm someone had a little spelling problem at The ServerSide :)

Nonetheless, here is what was discussed in Dan Sullivans article:

In summary a CTE can be used to implement a hierarchical query. The SELECT statement before the UNION ALL is executed first and just once. The SELECT statement after the UNION ALL is executed recursively until it produces no rows. The recursive query can reference the rows produced by the previous query. The SELECT statement that follows the CTE can reference all of the rows produced by the SELECT statements in the CTE. Check your recursive query closely to make sure that it will not recurse infinitly.

TheServerSide.NET - Heirarchical Queries in SQL Server 2005

Write a comment