The database design here uses nested sets. plpgsql, which is like PL/SQL, so it's not the T-SQL you were looking for. The code can be found in the Source link at the top of the page. It's a little messy too...
I do, however, have some T-SQL nested set stuff somewhere. Let me see if I can dig it up.