How To Retrieve All Tables and Number of Rows on SQL SERVER
This tip describes how to retrive all the tables names and the number of records of them
-- If You Use SQL Server 7 or 2000, try this
SELECT OBJECT_NAME(ID) As TableName, Rows As TotalRows
FROM SysIndexes WHERE IndID IN (0,1)
AND OBJECTPROPERTY(ID, 'IsUserTable') = 1
-- If You Use SQL Server 2005 or later, try this
SELECT OBJECT_NAME(Object_id) As TableName, SUM(Rows) As TotalRows
FROM sys.partitions
WHERE OBJECTPROPERTY(Object_id, 'IsUserTable') = 1 AND Index_ID IN (0,1)
GROUP BY OBJECT_NAME(Object_id)