• sandeep.cs3 (11/29/2010)


    A very crisp and clean way to retrieve all the tables along with its row count

    Row count of all tables in a database

    I looked at your rowcount sample and its short and sweet which is all the better in T-SQL in a SQL 2000 only environment.

    If though you are working with SQL 2005 or higher, know that per BOL the use of older SQL 2000 table ‘sysindexes’ ( which in 2005 is a view included for backward computability) is not recommended as it will be going away and has been replaced with view sys.indexes . Unfortunately the newer sys.indexes does not include rowcount or an equivalent and so you must join another view (sys.partitions works) or some other object to get your equivalent rowcount value. Note too that depending on whether you have portioned tables or not the method you employ may or may not return the correct rowcount in a partitioned table.

    Kindest Regards,

    Just say No to Facebook!