Jagan Mohan Reddy Rajidi
SQL query to display total number of rows for each table in database
Following query displays the total number of rows corresponding to each table in the database.
select o.name 'Table Name',rowcnt 'Total Number of Rows' from sysindexes i inner join sysobjects o on i.id=o.id where indid<2 and o.xtype='U' Order by 'Total Number of Rows' desc
Result of above query is sorted by the row count of table in descending order.