Finding Empty Tables in a database

  • Hey

    i have many tables in the database.Most of them are unused tables and empty Tables ..i need to find list of Finding Empty Tables in a database.

    R a j

  • There's probably some caveats to this approach, but you can try this for starters:

    SELECT OBJECT_SCHEMA_NAME(id)

    ,OBJECT_NAME(id)

    FROM SYS.SYSINDEXES WITH (NOLOCK)

    WHERE indid IN (0, 1)

    AND [rowcnt] = 0 ;

    Regards,

    Willem
    http://wschampheleer.wordpress.com[/url]

  • Willem's will work, providing you run update usage first. Otherwise the rowcounts can be inaccurate (sysindexes' row count is not 100% accurate)

    dbcc updateusage (0) with count_rows

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • If you are using SSMS 2008 client, you can see all the objects details in Object Explorer details tab Including Row count, data size, Index size etc.

    Enjoy!

    EnjoY!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply