I stumbled upon a great stored procedure for Recursive Queries (here), but I wanted to recreate it for AdventureWorks.
Note: This one only works on the previous AdventureWorks database (not 2008R2, the Employee table has changed). Soon I’ll be posting a modified version of this based upon the AdventureWorks2008R2 database.
Basicly the Employee-table is self referencing table with levels (also known as ‘Tree Walking‘) has an EmployeeId and ManagerId I’m going to use.
Want the SQL sourcecode? Click here