Wednesday , March 27 2019
Home / DataBase / SQL SERVER / Find all rows count and columns count in single database in sql server

Find all rows count and columns count in single database in sql server

In General for any database it contains lot of tables, if we want to find rows count and columns count for any table we need to write individual query for each and every table.

but in sql server we have a stored procedure called sp_msforeachtable it will return all table names and their rows count

by using sp_msforeachtable in below query we can find all tables rows and columns count along with table size


sp_msforeachtable rows count

if we want to get order by using data size run below query it will fetch records using datasize of the tables


sp_msforeachtable rows count


We hope you find the tip as helpful,  I hope you liked the article. Please share your valuable suggestions and feedback in the comments.

Print Friendly, PDF & Email

Give us your valuable feedback


About Murali

Hello everyone I am Software Developer having 3+ years of Experience in Microsoft Technologies and Others. My skills :-, C#,, SQL SERVER, web services, windows Service,Windows applications,HTML,CSS, JavaScript,JQuery,AnjularJs

Check Also

sql server backup script

Backup all databases in SQL Instance with one script

Backup: A copy of SQL Server data that can be used to restore and recover the …