Daily Archives: Nov 7, 2014


Get total number of rows for all tables

How to get total number of rows for all the tables in a particular database? In this post we are going to learn how we can get “total number of rows for all tables” in a database.

We will use the inbuilt system views of SQL Server to generate this list. Sometimes we need to pick some high record containing tables for some demo or any other purpose.
To get the desired output, first select the database for which you want to extract the list of tables with total number of rows as below;

 

Now use the below query and have a look on its output;

OR

Output :

total number of rows for all tables

From above output, you can see that we have extracted the list of all the tables for a particular database with total number of rows.

Analyze the used query above

In above query, I have used the inbuilt view SYS.Tables … More