List all tables and their Row Counts by a single query in a database?


After replication setup or reinitialization we need to check the  row counts of 2 databases in sql server2005 to verify the replication.


By running below query ,we can able to find out tables and their corresponding row counts in a single database.

Select as TableName,

 Max(i.rowcnt) as TotalRows


 sys.sysobjects o inner join sys.sysindexes i on

-–Only User defined tables

 Where o.xtype='U'

Group by


Popular posts from this blog

SQL Server:Steps to Configure Database Mirroring by T-SQL Script.

SSIS2008R2 Error: 0xC0209303 at Package: