MS SQL List of Records in All Tables

In MS SQL, run the following code to get the list of record numbers of all tables (created by the user) in a database.

SELECT [TableName] = sobj.name, [RowCount] = MAX(sind.rows) FROM sysobjects sobj, sysindexes sind WHERE sobj.xtype = 'U' AND sind.id = OBJECT_ID(sobj.name) GROUP BY sobj.name ORDER BY 2 DESC


You May Interest

What are the System Data Collection Sets Predefined Inside SQL Se ...

What is an Index in SQL Server ?

How to Rebuild the Master Database in SQL Server ?

What is Central Management in SQL Server ?

Changing MS SQL Database Name with Query