Please see my other Database Development articles.
Performing Recursive Queries.
Prior to SQL Server 2005, performing recursive actions on data required the use of temporary tables, cursive, or some other memory-intensive method.
Now, performing such operations requires much less code and avoids the previous performance increase.
For this example, we’ll begin with a generic table containing information about people.
On the “Person” table, we’ll first list all values from the “firstname” field.
Next, from the previous list, we’ll only return those values that begin with the letter ‘s’.
Here is the final resultset.