Get record count for every table in a DB (1 Step)

  • Comments posted to this topic are about the item Get record count for every table in a DB (1 Step)

  • cool...

    SELECT TableName ,i.rows TblRowCount

    FROM sysobjects o

    INNER JOIN sysindexes i ON ( =

    WHERE o.xtype = 'u'

    AND i.indid < 2

    order by TblRowCount desc

  • Better think about DBCC UPDATEUSAGE once in a while....

    --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".
    "Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"

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

  • Below is the best in sql2005

    SELECT object_name(object_id) 'Table_Name', SUM(row_count) 'Total_Rows'

    FROM sys.dm_db_partition_stats where index_id <2 GROUP BY object_name(object_id)

    ORDER BY object_name(object_id)

    Comments please....

    Srihari Nandamuri

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

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