Easiest way to get row count of every table in a database. You can use
sp_MSForEachTable
SP
CREATE TABLE
#Tablescounts
(table_name varchar(255),row_count int)
EXEC sp_MSForEachTable @command1 = 'INSERT #Tablescounts (table_name, row_count) SELECT ''?'',
COUNT(*) FROM ?'
SELECT * FROM #Tablescounts
Comments