List Row Count on All Tables in SQL Server Database

If you are using SQL Server 2008 or higher you can query the sys.partitions catalog view. The filed [rows] shows the number of records in each partition of the database table.

This query returns the schema and table names, and total number of rows. If you have only one partition for each table, you can wipe out SUM() and GROUP BY from the query.

Leave a Reply

Your email address will not be published. Required fields are marked *