How to get the Row Count of each table in a Database in SQL Server?

If you are working with SQL Server and looking for a way to get the row count of all tables in your database, you can do that using this SQL Query.

This Query will display a list of all Tables in your database and a count of the number of Rows the table has.

 

 

 

USE DatabaseName

SELECT object_name(id) AS TableName, rowcnt as Rows FROM sys.sysindexes

WHERE  object_name(id) not like 'sys%' and indid = 1
ORDER BY TableName