Home Forums SQL Server 2008 T-SQL (SS2K8) Hierarchy example - Ken Henderson's book - not working RE: Hierarchy example - Ken Henderson's book - not working

  • Maybe, but I'd have done it a different way. The original data already has more than 1 level.

    The original data also has a flaw in it that makes it impossible to enforce the rule that no one should report to themselves to prevent cycles in code. Groucho's superviser ID should have been NULL. A NULL would not interfere with the reference that a superviser ID must also be an employee ID.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)