SQL Server Tricks

  1. sp_msForEachTable 对每个表进行操作

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

你可能感兴趣的:(SQL Server)