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 is Failover Clustering in SQL Server ?

Getting Rows in a Table in Random Order in MS SQL

What is the Difference Between CHAR and VARCHAR Datatypes in SQL ...

What is the Merge Statement in SQL Server ?

What is TABLESAMPLE in SQL Server ?