• I ran the script on a database with three tables:

    1. dbo.LocationType (no foreign keys

    2. dbo.Locations (foreign key to dbo.LocationType)

    3. dbo.Fish (no foreign key defined, but it should have one to dbo.Locations)

    The script ouput was:

    LevelA

    0LocationType

    1Locations

    Are tables with no references to or from excluded from the output intentionally? I would have expected dbo.Fish to be returned as a level 0 table.

    When I added the foreign key to dbo.Fish, I got the expected results of dbo.Fish being a level 2 table.


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]