Finding row counts of tables in a database

Here is a handy T-SQL script to show tables in a database and how many rows are in each table. 

SELECT OBJECT_NAME(OBJECT_ID) TableName, row_count
FROM sys.dm_db_partition_stats
WHERE index_id < 2
ORDER BY row_count DESC

ABOUT THE AUTHOR

Kris Halsrud

Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

Submit a Comment

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

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) news and product updates!

You have Successfully Subscribed!