create table #rowcount (tablename varchar(128), rowcnt int)exec sp_MSforeachtable 'insert into #rowcount select ''?'', count(*) from ?'select * from #rowcount order by rowcnt descdrop table #rowcount